Skip to content
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

Merged
merged 5 commits into from
Dec 12, 2018
Merged

Add -diff option #4

merged 5 commits into from
Dec 12, 2018

Conversation

fujiwara
Copy link
Contributor

@fujiwara fujiwara commented Dec 7, 2018

Hi.

I added -diff option to calculate metrics difference that like incremental counters.

Calculate difference of metrics that matches the expression.
Copy link
Contributor

@Songmu Songmu left a 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)
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@Songmu
Copy link
Contributor

Songmu commented Dec 12, 2018

Thanks!

@Songmu Songmu merged commit f76c857 into mackerelio:master Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants