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

Adding support for honoring buckets passed as part of creating Promet… #173

Closed
wants to merge 1 commit into from

Conversation

Rdgarg
Copy link

@Rdgarg Rdgarg commented Mar 27, 2024

…heusClient

@rycus86
Copy link
Owner

rycus86 commented Mar 27, 2024

Hi,

Thanks for opening this PR! Is there a specific problem you're solving? Is there perhaps a unit test you could add to go with this change?

Thanks!

@coveralls
Copy link

Coverage Status

coverage: 84.483% (+0.9%) from 83.617%
when pulling d11c7b3 on Rdgarg:master
into 9e20f3f on rycus86:master.

@Rdgarg Rdgarg closed this Mar 27, 2024
@Rdgarg Rdgarg reopened this Mar 27, 2024
@Rdgarg
Copy link
Author

Rdgarg commented Mar 27, 2024

Hi ,

Recently I stumbled on one issue in which histogram metrics were not honoring the buckets passed during PrometheusMetrics initialization.

Code snippet

buckets = (0.005, 0.1, 0.2, INF)
metrics = PrometheusMetrics(app, buckets=buckets)
shorten_url_duration = metrics.histogram('shorten_url_duration', 'Duration of shorten_url call')

Sample Response

shorten_url_duration_bucket{le="0.005"} 0.0
shorten_url_duration_bucket{le="0.01"} 0.0
shorten_url_duration_bucket{le="0.025"} 0.0
shorten_url_duration_bucket{le="0.05"} 0.0
shorten_url_duration_bucket{le="0.075"} 0.0
shorten_url_duration_bucket{le="0.1"} 0.0
shorten_url_duration_bucket{le="0.25"} 0.0
shorten_url_duration_bucket{le="0.5"} 0.0
shorten_url_duration_bucket{le="0.75"} 0.0
shorten_url_duration_bucket{le="1.0"} 0.0
shorten_url_duration_bucket{le="2.5"} 0.0
shorten_url_duration_bucket{le="5.0"} 0.0
shorten_url_duration_bucket{le="7.5"} 0.0
shorten_url_duration_bucket{le="10.0"} 0.0
shorten_url_duration_bucket{le="+Inf"} 0.0

Expected Response

shorten_url_duration_bucket{le="0.005"} 0.0
shorten_url_duration_bucket{le="0.1"} 0.0
shorten_url_duration_bucket{le="0.2"} 0.0
shorten_url_duration_bucket{le="+Inf"} 0.0

@Rdgarg
Copy link
Author

Rdgarg commented Mar 27, 2024

Will add unit tests, mistakenely this PR got raised to the original repo instead of my fork :(
Sorry

@Rdgarg Rdgarg closed this Mar 27, 2024
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