Title: Counter name/type inference changed in 1.6.1 for untyped metrics, breaking downstream expectation of UNKNOWN · Issue #2087 · prometheus/client_java · GitHub
Open Graph Title: Counter name/type inference changed in 1.6.1 for untyped metrics, breaking downstream expectation of UNKNOWN · Issue #2087 · prometheus/client_java
X Title: Counter name/type inference changed in 1.6.1 for untyped metrics, breaking downstream expectation of UNKNOWN · Issue #2087 · prometheus/client_java
Description: Summary After upgrading The JMX Exporter from 1.5.1 to 1.6.1, a metric that was previously discoverable as an untyped/unknown metric is now exposed as a counter with a _total suffix. This appears to change behavior for metrics where the ...
Open Graph Description: Summary After upgrading The JMX Exporter from 1.5.1 to 1.6.1, a metric that was previously discoverable as an untyped/unknown metric is now exposed as a counter with a _total suffix. This appears t...
X Description: Summary After upgrading The JMX Exporter from 1.5.1 to 1.6.1, a metric that was previously discoverable as an untyped/unknown metric is now exposed as a counter with a _total suffix. This appears t...
Opengraph URL: https://github.com/prometheus/client_java/issues/2087
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Counter name/type inference changed in 1.6.1 for untyped metrics, breaking downstream expectation of UNKNOWN","articleBody":"## Summary\n\nAfter upgrading The JMX Exporter from `1.5.1` to `1.6.1`, a metric that was previously discoverable as an untyped/unknown metric is now exposed as a counter with a `_total` suffix.\n\nThis appears to change behavior for metrics where the downstream library did **not** explicitly configure the type, and only optionally supports its own local heuristic for inferring counters from names.\n\n## Why this matters\n\nJMX Exporter supports this config option:\n\n- `inferCounterTypeFromName: true|false`\n\nExpected behavior from the JMX Exporter perspective:\n\n- when `inferCounterTypeFromName: false`, metrics without an explicit configured type should remain `UNKNOWN`\n- when `inferCounterTypeFromName: true`, names ending in `_total` may be treated as counters\n\nAfter upgrading to `client_java 1.6.1`, it looks like `client_java` is applying counter naming/type behavior in a way that changes the effective metric identity for downstream code inspecting registry output.\n\n## Observed behavior\n\nA generated metric based on JMX rule output is looked up under the name:\n\n- `kafka_consumer_request`\n\nWith `1.6.1`, the actual scraped metric is:\n\n- `kafka_consumer_request_total`\n\nand it is exposed as a counter snapshot.\n\nIn other words, the same logical downstream metric appears to have shifted from:\n\n- unknown/untyped metric identity: `kafka_consumer_request`\n\nto:\n\n- counter metric identity: `kafka_consumer_request_total`\n\n## Why this looks like a regression\n\nFrom the downstream library’s perspective, there is an important distinction between:\n\n1. **explicit or locally inferred metric type**, and\n2. **Prometheus naming normalization**\n\nIf the downstream library does **not** set type to counter, we would expect the metric to remain `UNKNOWN`.\n\nIf `client_java` now turns an untyped metric into counter-style exported identity purely because of naming rules, that seems to bypass downstream type semantics.\n\nThis is especially concerning for the equivalent of our `inferCounterTypeFromName: false` case, where the downstream library is explicitly saying “do not infer counter type from name”.\n\n## Reproduction shape\n\nUsing JMX Exporter-style logic, a rule generates a metric name from an attribute like `request-total`, resulting in a base metric name around:\n\n- `kafka_consumer_request`\n\nThere is no explicit configured type in the rule.\n\nExpected with local inference disabled:\n- metric remains `UNKNOWN`\n- metric remains discoverable as `kafka_consumer_request`\n\nObserved in `1.6.1`:\n- metric is exposed as `kafka_consumer_request_total`\n- metric is a counter snapshot\n\n## Impact\n\nThis breaks downstream tests and exact-name registry inspection logic, even though the downstream library did not explicitly opt into counter typing in the affected case.\n","author":{"url":"https://github.com/dhoard","@type":"Person","name":"dhoard"},"datePublished":"2026-05-01T18:43:16Z","url":"https://github.com/prometheus/client_java/issues/2087"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9e48565c-a7af-08ec-e7a5-90667dcb7d6d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B63A:85870:62FC0:8A3FC:6AFBB671 |
| html-safe-nonce | dbdc41e33887e7b00a4a98d2dd74ae41d9aff0c0663cc40096e4755d292c3a7a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjNBOjg1ODcwOjYyRkMwOjhBM0ZDOjZBRkJCNjcxIiwidmlzaXRvcl9pZCI6IjYyNzg1NjM4NjI4ODY5ODczNzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0c305744a0bebd0a5010e7ce6e503255073b86c68e12e762edc8ea78088bc24d |
| hovercard-subject-tag | issue:4366078547 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/prometheus/client_java/2087/issue_layout |
| twitter:image | https://opengraph.githubassets.com/96f047fb87ab1397786e43658cedb4d4bb4eda6ed2736f175010295fc0e4e9d6/prometheus/client_java/issues/2087 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/96f047fb87ab1397786e43658cedb4d4bb4eda6ed2736f175010295fc0e4e9d6/prometheus/client_java/issues/2087 |
| og:image:alt | Summary After upgrading The JMX Exporter from 1.5.1 to 1.6.1, a metric that was previously discoverable as an untyped/unknown metric is now exposed as a counter with a _total suffix. This appears t... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dhoard |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c |
| turbo-cache-control | no-preview |
| go-import | github.com/prometheus/client_java git https://github.com/prometheus/client_java.git |
| octolytics-dimension-user_id | 3380462 |
| octolytics-dimension-user_login | prometheus |
| octolytics-dimension-repository_id | 7997879 |
| octolytics-dimension-repository_nwo | prometheus/client_java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7997879 |
| octolytics-dimension-repository_network_root_nwo | prometheus/client_java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e4cce0e99cf61481a318ff12c2e8580153a6c7c6 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width