Skip to content

Count NaN histogram observations in the +Inf bucket - #1225

Open
zhechen-cs wants to merge 1 commit into
prometheus:masterfrom
zhechen-cs:codex/histogram-nan-count
Open

zhechen-cs wants to merge 1 commit into
prometheus:masterfrom
zhechen-cs:codex/histogram-nan-count

Conversation

@zhechen-cs

Copy link
Copy Markdown

Histogram.observe(float('nan')) updates the sum but increments no bucket, so both _count and the +Inf bucket omit the observation. Count these observations in the overflow bucket while retaining the NaN sum and leaving finite bucket counts unchanged. This matches the classic-histogram handling described in the Prometheus histogram specification.

Added regressions for ordinary histograms and aggregation from two multiprocess metric files. Both fail on the unmodified base.

Validation on macOS / Python 3.12:

  • Targeted histogram and multiprocess tests: 48 passed.
  • Full suite: 443 passed, 1 skipped, 28 subtests passed.
  • tox -e flake8,isort,mypy and git diff --check: passed.

Local HTTP tests used NO_PROXY=localhost,127.0.0.1,::1 to bypass the local proxy; the proxy's HTTP 502 failure also reproduces on the unmodified base.

@csmarchbanks

Signed-off-by: Zhe Chen <zhechen.cs@connect.hku.hk>

This branch has not been deployed

No deployments
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.

1 participant