-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add -diff option #4
Conversation
Calculate difference of metrics that matches the expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is almost OK, but I want you to check one point.
func (p JSONPlugin) tempfilename() string { | ||
// tempfiles have an unique name for each configuration. | ||
filename := fmt.Sprintf("mackerel-plugin-json.%x", sha1.Sum([]byte(p.Prefix+p.URL))) | ||
return filepath.Join(pluginutil.PluginWorkDir(), filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using pluginutil
is very good 👍
} | ||
defer os.RemoveAll(dir) | ||
os.Setenv("MACKEREL_PLUGIN_WORKDIR", dir) // to separate tempfile for each test | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you restore original "MACKERE_PLUGIN_WORKDIR" value with defer
? It may cause adverse effects on other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed at 3e5393b. Please confirm it.
Thanks! |
Hi.
I added
-diff
option to calculate metrics difference that like incremental counters.