Skip to content

Honoring buckets passed while initializing PrometheusMetrics in Histogram #174

@Rdgarg

Description

@Rdgarg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions