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

Change scrape_duration_seconds to gauge #90

Merged
merged 2 commits into from
Jul 5, 2017
Merged

Conversation

carlpett
Copy link
Collaborator

@carlpett carlpett commented Jul 5, 2017

Currently the scrape_duration_seconds metric is a summary. When trying to reason about #89, it is hard to look back in time to see if others have this problem as well, since we do not have the buckets. I see no real benefit in using a summary here, and think we should be using a histogram instead.

Probably we should be setting the Buckets option as well, rather than using the defaults. My lowest 0.5 quantile with the current summary is ~0.04s, so I would make an initial guess that something like [0.01, 0.015, 0.03, 0.1, 0.15, 0.3, 1.0, 3.0, Inf] would capture the interesting ranges with acceptable precision?

@martinlindhe
Copy link
Collaborator

So, the bucket gets configured by the user and not by us?

Reading up on https://prometheus.io/docs/practices/histograms/

@brian-brazil
Copy link
Collaborator

This should be a gauge, which contains the information for that scrape.

This was fixed a while back on the node exporter, I'm guessing this was copied from before then.

@carlpett carlpett changed the title Change scrape_duration_seconds to histogram Change scrape_duration_seconds to gauge Jul 5, 2017
@carlpett
Copy link
Collaborator Author

carlpett commented Jul 5, 2017

@brian-brazil Ah, that makes sense. Yes, the summary is probably from the initial commit, more or less.
I changed to a gauge now, as well as split the result into a separate gauge.

exporter.go Outdated

if err != nil {
log.Errorf("ERROR: %s collector failed after %fs: %s", name, duration.Seconds(), err)
result = "error"
scrapeSuccess.WithLabelValues(name).Set(0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use ConstMetrics, so there's no interference from any scrapes happening at the same time

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Fixed!

@brian-brazil
Copy link
Collaborator

👍

@martinlindhe
Copy link
Collaborator

LGTM!

@martinlindhe martinlindhe merged commit 1ebee26 into master Jul 5, 2017
@carlpett carlpett deleted the histogram-durations branch May 12, 2018 08:18
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.

3 participants