From 287074830b774082f329817d6f1f20ef04c9a360 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 3 Jul 2026 14:21:19 +0200 Subject: [PATCH 1/2] chore(deps): update dependency mise to v2026.7.0 (#2272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Update | Change | |---|---|---| | [mise](https://redirect.github.com/jdx/mise) | minor | `v2026.6.14` → `v2026.7.0` | --- ### Release Notes
jdx/mise (mise) ### [`v2026.7.0`](https://redirect.github.com/jdx/mise/releases/tag/v2026.7.0): : Shell expansion by default, monorepo lockfiles, and task usage mounts [Compare Source](https://redirect.github.com/jdx/mise/compare/vfox-v2026.6.14...vfox-v2026.7.0) ##### Added - **env:** enable shell expansion by default; opt out with `env_shell_expand = false` ([#​10702](https://redirect.github.com/jdx/mise/pull/10702) by [@​jdx](https://redirect.github.com/jdx)). - **monorepo:** `mise install --monorepo` and `mise ls --monorepo` install/list the union of tools across `[monorepo].config_roots`; new tri-state `[monorepo].lockfile` for unified root lockfiles ([#​10707](https://redirect.github.com/jdx/mise/pull/10707) by [@​jdx](https://redirect.github.com/jdx)). - **task:** root-level `#USAGE mount ...` in file tasks (including shorthand `mount "cmd"`) hoists mounted usage specs onto the generated task command ([#​10704](https://redirect.github.com/jdx/mise/pull/10704) by [@​jdx](https://redirect.github.com/jdx)). - **github:** per-tool `github_attestations` option to disable GitHub Artifact Attestation verification for a single tool ([#​10694](https://redirect.github.com/jdx/mise/pull/10694) by [@​jdx](https://redirect.github.com/jdx)). - **upgrade:** `minimum_release_age` warnings now include the release date, when the version becomes eligible, and the effective cutoff value ([#​10705](https://redirect.github.com/jdx/mise/pull/10705) by [@​jdx](https://redirect.github.com/jdx)). - **bootstrap:** brew formulae prune is now prefix-inventory based and can remove any linked formula outside the resolved `[bootstrap.packages]` closure ([#​10618](https://redirect.github.com/jdx/mise/pull/10618) by [@​jdx](https://redirect.github.com/jdx)). - **brew:** support cask `font` artifacts and additional non-install artifact types (completions/manpages) ([#​10671](https://redirect.github.com/jdx/mise/pull/10671) by [@​roele](https://redirect.github.com/roele)). - **platform:** Android asset detection for tools like Termux packages ([#​10653](https://redirect.github.com/jdx/mise/pull/10653) by [@​bltavares](https://redirect.github.com/bltavares)). ##### Fixed - **install:** respect the lockfile-recorded backend during `--locked` installs ([#​10599](https://redirect.github.com/jdx/mise/pull/10599) by [@​risu729](https://redirect.github.com/risu729)). - **install:** installer prints a clearer message and suggests `cargo install --locked mise` on unsupported architectures ([#​10627](https://redirect.github.com/jdx/mise/pull/10627) by [@​risu729](https://redirect.github.com/risu729)). - **install-into:** refuse to overwrite a non-empty target directory without `--yes` ([#​10630](https://redirect.github.com/jdx/mise/pull/10630) by [@​JamBalaya56562](https://redirect.github.com/JamBalaya56562)). - **aqua:** resolve bin paths with `v`-prefixed version overrides (e.g. `sharkdp/fd@10.3.0`) ([#​10696](https://redirect.github.com/jdx/mise/pull/10696) by [@​jdx](https://redirect.github.com/jdx)). - **aqua:** download private GitHub release assets via the API asset endpoint when the browser URL 404s ([#​10622](https://redirect.github.com/jdx/mise/pull/10622) by [@​yacchi](https://redirect.github.com/yacchi)). - **brew-cask:** handle raw executable binaries, resolve `$APPDIR` paths, and use `ditto` for app bundle copying to avoid macOS "damaged app" errors ([#​10626](https://redirect.github.com/jdx/mise/pull/10626) by [@​arthurh4](https://redirect.github.com/arthurh4)). - **config:** preserve set values in `mise config set` for comma-separated set-typed settings ([#​10647](https://redirect.github.com/jdx/mise/pull/10647) by [@​KrishRVH](https://redirect.github.com/KrishRVH)). - **config:** render `task_config.includes` templates with resolved `vars` ([#​10700](https://redirect.github.com/jdx/mise/pull/10700) by [@​jdx](https://redirect.github.com/jdx)). - **config:** support `required` validation and `redact = true` on `[vars]`; render tool option templates recursively ([#​10697](https://redirect.github.com/jdx/mise/pull/10697) by [@​jdx](https://redirect.github.com/jdx)). - **dotnet:** validate SDK installs with `dotnet --list-sdks` so `global.json` roll-forward no longer causes false failures ([#​10691](https://redirect.github.com/jdx/mise/pull/10691) by [@​jdx](https://redirect.github.com/jdx)). - **generate:** `mise generate tool-stub --lock` respects configured `lockfile_platforms` ([#​10709](https://redirect.github.com/jdx/mise/pull/10709) by [@​JamBalaya56562](https://redirect.github.com/JamBalaya56562)). - **github:** handle missing/empty `url_api` in older lockfile entries, falling back to the cached browser URL ([#​10703](https://redirect.github.com/jdx/mise/pull/10703) by [@​jdx](https://redirect.github.com/jdx)). - **hooks:** set `MISE_INSTALLED_TOOLS=[]` on no-op installs so `postinstall` always receives a valid JSON array ([#​10615](https://redirect.github.com/jdx/mise/pull/10615) by [@​JamBalaya56562](https://redirect.github.com/JamBalaya56562)). - **http:** don't let netrc credentials clobber explicit forge tokens on un-redirected URLs, fixing private GitHub release asset downloads ([#​10713](https://redirect.github.com/jdx/mise/pull/10713) by [@​yacchi](https://redirect.github.com/yacchi)). - **lockfile:** merge platform data when a tool's options newly diverge from an empty on-disk entry (e.g. java `shorthand_vendor`), preventing checksum/URL loss ([#​10710](https://redirect.github.com/jdx/mise/pull/10710) by [@​JamBalaya56562](https://redirect.github.com/JamBalaya56562)). - **npm:** map `allow_builds` to npm 11.16+ `--allow-scripts` / `--dangerously-allow-all-scripts` instead of forcing `--ignore-scripts` ([#​10690](https://redirect.github.com/jdx/mise/pull/10690) by [@​jdx](https://redirect.github.com/jdx)). - **oci:** canonicalize install paths when rebasing `PATH`, fixing `mise oci` on systems with symlinked `/home` (Bluefin/Silverblue) ([#​10624](https://redirect.github.com/jdx/mise/pull/10624) by [@​salim-b](https://redirect.github.com/salim-b)). - **oci:** account for darwin mode stripping in layer test expectations ([#​10681](https://redirect.github.com/jdx/mise/pull/10681) by [@​laozc](https://redirect.github.com/laozc)). - **ruby:** stop forcing `no-yjit` Ruby builds on older glibc ([#​10620](https://redirect.github.com/jdx/mise/pull/10620) by [@​jdx](https://redirect.github.com/jdx)). - **sigstore:** retry GitHub attestation verification with the TUF trust root after embedded-root failures; workflow mismatches remain non-retryable ([#​10695](https://redirect.github.com/jdx/mise/pull/10695) by [@​jdx](https://redirect.github.com/jdx)). - **task:** render monorepo subproject task templates with the subproject's own `[env]`; broken subprojects no longer fail discovery repo-wide ([#​10706](https://redirect.github.com/jdx/mise/pull/10706) by [@​jdx](https://redirect.github.com/jdx)). - **task:** correct env used for the `task.show_full_cmd` setting ([#​10714](https://redirect.github.com/jdx/mise/pull/10714) by [@​muzimuzhi](https://redirect.github.com/muzimuzhi)). - **vfox:** Lua `os.getenv` now reads from mise's env table like `cmd.exec`/`os.execute` ([#​10719](https://redirect.github.com/jdx/mise/pull/10719) by [@​jdx](https://redirect.github.com/jdx)). - **watch:** forward `--ignore`, `--ignore-file`, and `--print-events` to watchexec ([#​10629](https://redirect.github.com/jdx/mise/pull/10629) by [@​JamBalaya56562](https://redirect.github.com/JamBalaya56562)). - **windows:** allow GHCUp to be installed on Windows via aqua ([#​10670](https://redirect.github.com/jdx/mise/pull/10670) by [@​cprecioso](https://redirect.github.com/cprecioso)). - **copr:** drop retired Fedora 42 chroots from the default build list ([#​10698](https://redirect.github.com/jdx/mise/pull/10698) by [@​jdx](https://redirect.github.com/jdx)). ##### Security - Ignore transitive `quick-xml` advisories RUSTSEC-2026-0194/-0195 pending upstream fixes ([#​10717](https://redirect.github.com/jdx/mise/pull/10717) by [@​jdx](https://redirect.github.com/jdx)). ##### 💚 Sponsor mise mise is built by [@​jdx](https://redirect.github.com/jdx) under [**en.dev**](https://en.dev) — an independent studio making developer tooling (mise, [aube](https://aube.en.dev/), and more). Development is funded by sponsors. If mise saves you or your team time, please consider sponsoring at [en.dev](https://en.dev). Individual and company sponsorships keep mise fast, free, and independent.
--- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 4am on Monday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/prometheus/client_java). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Arnab Nandy --- .github/workflows/acceptance-tests.yml | 4 ++-- .github/workflows/api-diff.yml | 4 ++-- .github/workflows/build.yml | 4 ++-- .github/workflows/bump-api-diff-baseline.yml | 4 ++-- .github/workflows/generate-protobuf.yml | 4 ++-- .github/workflows/github-pages.yaml | 4 ++-- .github/workflows/java-version-matrix-tests.yml | 4 ++-- .github/workflows/jmx-exporter-compatibility.yml | 4 ++-- .github/workflows/lint.yml | 4 ++-- .github/workflows/micrometer-compatibility.yml | 4 ++-- .github/workflows/native-tests.yml | 4 ++-- .github/workflows/nightly-benchmarks.yml | 4 ++-- .github/workflows/regenerate-api-diff-otel.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- .github/workflows/test-release-build.yml | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 27391a6a7..749cfe4b6 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Run acceptance tests run: mise run acceptance-test diff --git a/.github/workflows/api-diff.yml b/.github/workflows/api-diff.yml index ea5566409..fc4cf2070 100644 --- a/.github/workflows/api-diff.yml +++ b/.github/workflows/api-diff.yml @@ -34,8 +34,8 @@ jobs: persist-credentials: false - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1aac83548..b2c57c817 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,8 +14,8 @@ jobs: persist-credentials: false - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: diff --git a/.github/workflows/bump-api-diff-baseline.yml b/.github/workflows/bump-api-diff-baseline.yml index a9d5e0328..ced6d6436 100644 --- a/.github/workflows/bump-api-diff-baseline.yml +++ b/.github/workflows/bump-api-diff-baseline.yml @@ -35,8 +35,8 @@ jobs: persist-credentials: true - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: diff --git a/.github/workflows/generate-protobuf.yml b/.github/workflows/generate-protobuf.yml index c21f21a65..a2666ebd8 100644 --- a/.github/workflows/generate-protobuf.yml +++ b/.github/workflows/generate-protobuf.yml @@ -20,8 +20,8 @@ jobs: persist-credentials: false - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: diff --git a/.github/workflows/github-pages.yaml b/.github/workflows/github-pages.yaml index 2d9c23ef1..722c2ce7c 100644 --- a/.github/workflows/github-pages.yaml +++ b/.github/workflows/github-pages.yaml @@ -39,8 +39,8 @@ jobs: fetch-depth: 0 - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 cache: "false" - name: Setup Pages id: pages diff --git a/.github/workflows/java-version-matrix-tests.yml b/.github/workflows/java-version-matrix-tests.yml index a9fe18a4a..58979b171 100644 --- a/.github/workflows/java-version-matrix-tests.yml +++ b/.github/workflows/java-version-matrix-tests.yml @@ -33,8 +33,8 @@ jobs: - name: Set up mise uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 diff --git a/.github/workflows/jmx-exporter-compatibility.yml b/.github/workflows/jmx-exporter-compatibility.yml index 93a72f909..b7cf4e8b1 100644 --- a/.github/workflows/jmx-exporter-compatibility.yml +++ b/.github/workflows/jmx-exporter-compatibility.yml @@ -24,8 +24,8 @@ jobs: persist-credentials: false - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 working_directory: .mise/envs/jmx-exporter - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 52600d464..ad8964bd8 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,8 +23,8 @@ jobs: - name: Setup mise uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Lint env: diff --git a/.github/workflows/micrometer-compatibility.yml b/.github/workflows/micrometer-compatibility.yml index 32c358e54..2d15c0f8e 100644 --- a/.github/workflows/micrometer-compatibility.yml +++ b/.github/workflows/micrometer-compatibility.yml @@ -32,8 +32,8 @@ jobs: persist-credentials: false - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 working_directory: .mise/envs/micrometer - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 diff --git a/.github/workflows/native-tests.yml b/.github/workflows/native-tests.yml index 90750250b..44cf92138 100644 --- a/.github/workflows/native-tests.yml +++ b/.github/workflows/native-tests.yml @@ -15,8 +15,8 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 working_directory: .mise/envs/native - name: Run native tests working-directory: .mise/envs/native diff --git a/.github/workflows/nightly-benchmarks.yml b/.github/workflows/nightly-benchmarks.yml index 9f91107e6..af4cffc68 100644 --- a/.github/workflows/nightly-benchmarks.yml +++ b/.github/workflows/nightly-benchmarks.yml @@ -36,8 +36,8 @@ jobs: - name: Setup mise uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 diff --git a/.github/workflows/regenerate-api-diff-otel.yml b/.github/workflows/regenerate-api-diff-otel.yml index ab8eef870..c35724644 100644 --- a/.github/workflows/regenerate-api-diff-otel.yml +++ b/.github/workflows/regenerate-api-diff-otel.yml @@ -20,8 +20,8 @@ jobs: persist-credentials: false - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c713c289e..4644f8ca3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,8 +71,8 @@ jobs: - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 cache: false - name: Build release version diff --git a/.github/workflows/test-release-build.yml b/.github/workflows/test-release-build.yml index 25332df64..e8a91f98b 100644 --- a/.github/workflows/test-release-build.yml +++ b/.github/workflows/test-release-build.yml @@ -20,8 +20,8 @@ jobs: fetch-depth: 0 - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 with: - version: v2026.6.14 - sha256: 96ae1ef7b00a6ebbbec23ba1016d6e722f5e904966272f621d15326429e90d53 + version: v2026.7.0 + sha256: 0744cb3c303baf0d308ff7b112ed41f22abb6029cb5644fd3a8ce74b29f16a68 - name: Cache local Maven repository uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: From 6e89c791f5054195a35bba61d3852b131ecffa98 Mon Sep 17 00:00:00 2001 From: Arnab Nandy Date: Fri, 3 Jul 2026 18:14:43 +0530 Subject: [PATCH 2/2] Fix native histogram bucket index merge on scale-down Signed-off-by: Arnab Nandy --- .../metrics/core/metrics/Histogram.java | 2 +- .../metrics/core/metrics/HistogramTest.java | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Histogram.java b/prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Histogram.java index 9a7f9b7c9..c4bb1f5fe 100644 --- a/prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Histogram.java +++ b/prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/Histogram.java @@ -614,7 +614,7 @@ private void doubleBucketWidth(Map buckets) { } buckets.clear(); for (i = 0; i < keys.length; i++) { - int index = (keys[i] + 1) / 2; + int index = (keys[i] > 0 ? keys[i] + 1 : keys[i]) / 2; LongAdder count = buckets.computeIfAbsent(index, k -> new LongAdder()); count.add(values[i]); } diff --git a/prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/HistogramTest.java b/prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/HistogramTest.java index 69518205d..cbfd5fade 100644 --- a/prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/HistogramTest.java +++ b/prometheus-metrics-core/src/test/java/io/prometheus/metrics/core/metrics/HistogramTest.java @@ -28,7 +28,9 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Random; import java.util.concurrent.CompletionService; import java.util.concurrent.CountDownLatch; @@ -39,6 +41,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.LongAdder; import java.util.stream.Collectors; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -836,6 +839,36 @@ void testNativeBucketIndexToUpperBound() } } + @Test + void testDoubleBucketWidthMergesNegativeIndexesCorrectly() + throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + Histogram histogram = Histogram.builder().name("test").nativeOnly().build(); + Histogram.DataPoint dataPoint = histogram.newDataPoint(); + + Method doubleBucketWidth = + Histogram.DataPoint.class.getDeclaredMethod("doubleBucketWidth", Map.class); + doubleBucketWidth.setAccessible(true); + + int[] keys = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5}; + int[] expectedMergedIndexes = {-2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3}; + + for (int i = 0; i < keys.length; i++) { + Map buckets = new HashMap<>(); + LongAdder adder = new LongAdder(); + adder.add(7); + buckets.put(keys[i], adder); + + doubleBucketWidth.invoke(dataPoint, buckets); + + assertThat(buckets.keySet()) + .as("merged index for original key " + keys[i]) + .containsExactly(expectedMergedIndexes[i]); + assertThat(buckets.get(expectedMergedIndexes[i]).sum()) + .as("count preserved for original key " + keys[i]) + .isEqualTo(7); + } + } + /** * Test if lowerBound < value <= upperBound is true for the bucket index returned by * findBucketIndex()