René's URL Explorer Experiment


Title: Don't escape UTF-8 names by default for OpenMetrics 2.0 · Issue #2517 · prometheus/client_java · GitHub

Open Graph Title: Don't escape UTF-8 names by default for OpenMetrics 2.0 · Issue #2517 · prometheus/client_java

X Title: Don't escape UTF-8 names by default for OpenMetrics 2.0 · Issue #2517 · prometheus/client_java

Description: When a scraper negotiates OpenMetrics 2.0 (Accept: application/openmetrics-text;version=2.0.0) without an escaping parameter, PrometheusScrapeHandler escapes UTF-8 metric and label names with EscapingScheme.DEFAULT (underscores). OpenMet...

Open Graph Description: When a scraper negotiates OpenMetrics 2.0 (Accept: application/openmetrics-text;version=2.0.0) without an escaping parameter, PrometheusScrapeHandler escapes UTF-8 metric and label names with Escap...

X Description: When a scraper negotiates OpenMetrics 2.0 (Accept: application/openmetrics-text;version=2.0.0) without an escaping parameter, PrometheusScrapeHandler escapes UTF-8 metric and label names with Escap...

Opengraph URL: https://github.com/prometheus/client_java/issues/2517

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Don't escape UTF-8 names by default for OpenMetrics 2.0","articleBody":"When a scraper negotiates OpenMetrics 2.0 (`Accept: application/openmetrics-text;version=2.0.0`) without an `escaping` parameter, `PrometheusScrapeHandler` escapes UTF-8 metric and label names with `EscapingScheme.DEFAULT` (underscores). **OpenMetrics 2.0 supports UTF-8 names natively and doesn't define an `escaping` parameter at all, so we could assume that scraper asking for 2.0.0 already supports UTF-8 names. In that case we shouldn't escape by default.**\n\nPrometheus main doesn't send `escaping` for OM 2.0 (\u003chttps://github.com/prometheus/prometheus/blob/961c9ba40923ca4d7adf4a7a9167e56d0406df83/scrape/scrape.go#L794-L800>), so UTF-8 names are currently escaped to underscores when scraping a Java target with OM 2.0. There's a Prometheus-side workaround in \u003chttps://github.com/prometheus/prometheus/compare/main...bwplotka/om2-accept-escaping>, but the default here should be fixed regardless.\n\nThe escaping scheme is chosen without looking at the selected format:\n\n- `EscapingScheme.fromAcceptHeader` returns `DEFAULT` when there's no `escaping` term: \u003chttps://github.com/prometheus/client_java/blob/9e9deb6b9e591c2a62b12882d8a987f120661b71/prometheus-metrics-config/src/main/java/io/prometheus/metrics/config/EscapingScheme.java#L29-L67>.\n- `PrometheusScrapeHandler` computes it before, and separately from, `findWriter`: \u003chttps://github.com/prometheus/client_java/blob/9e9deb6b9e591c2a62b12882d8a987f120661b71/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusScrapeHandler.java#L73-L91>.\n- `ExpositionFormats.findWriter` picks the OM 2.0 writer: \u003chttps://github.com/prometheus/client_java/blob/9e9deb6b9e591c2a62b12882d8a987f120661b71/prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormats.java#L63-L86>.\n\nProposed change (pseudo code):\n\n```java\n// PrometheusScrapeHandler\nString acceptHeader = request.getHeader(\"Accept\");\nExpositionFormatWriter writer = expositionFormats.findWriter(acceptHeader);\nEscapingScheme escapingScheme = EscapingScheme.fromAcceptHeader(acceptHeader, defaultFor(acceptHeader));\n\n// Only default to UTF-8 when 2.0.0 was explicitly requested. With\n// contentNegotiation=false the OM 2.0 writer also serves OM 1.0 / unversioned\n// requests, e.g. from pre-3.0 Prometheus that can't parse UTF-8 names.\nEscapingScheme defaultFor(String acceptHeader) {\n  return \"2.0.0\".equals(parseOpenMetricsVersion(acceptHeader))\n      ? EscapingScheme.ALLOW_UTF8\n      : EscapingScheme.DEFAULT;\n}\n\n// EscapingScheme\npublic static EscapingScheme fromAcceptHeader(@Nullable String acceptHeader, EscapingScheme fallback) {\n  // Same parsing as today. An explicit escaping term always wins, also for OM 2.0\n  // (e.g. a Prometheus with legacy name validation asking for underscores).\n  // Return fallback instead of DEFAULT when the term is missing or unknown.\n}\n```\n\nExisting `fromAcceptHeader(String)` can keep delegating with `DEFAULT` to stay API compatible. Ideally the version and escaping term should come from the same Accept clause that `findWriter` matched. Today both helpers scan the whole header, so a parameter from another clause can leak in.\n\nTests to add (e.g. `ExpositionFormatsTest`, plus a scrape handler test):\n\n- `version=2.0.0` without `escaping` writes unescaped UTF-8 names.\n- `version=2.0.0;escaping=underscores` still escapes.\n- `version=1.0.0`, unversioned OpenMetrics and `text/plain` without `escaping` keep the underscores default, including with `contentNegotiation=false`.\n\nThe escaping schemes doc should get the same OM 2.0 exception, since its \"Default Behavior\" section says to use underscores whenever `escaping` is missing: \u003chttps://github.com/prometheus/docs/blob/605cf81fefc2e8e91f8ba89bb1555ae52a43a318/docs/instrumenting/escaping_schemes.md#default-behavior>.\n\nMatching client_golang issue: https://github.com/prometheus/client_golang/issues/2149\n","author":{"url":"https://github.com/bwplotka","@type":"Person","name":"bwplotka"},"datePublished":"2026-10-03T14:44:30Z","url":"https://github.com/prometheus/client_java/issues/2517"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9ded6fcc-101a-711c-f9d1-3f017ce39e21
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE648:9AE98:216FB9:2C7C1D:6AFBB525
html-safe-nonce913d491b416254e4d6dddaf44894afc23de3ffd991a1addd41f8d8d395e0823b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjQ4OjlBRTk4OjIxNkZCOToyQzdDMUQ6NkFGQkI1MjUiLCJ2aXNpdG9yX2lkIjoiNjczMDMxODA5NjU2MjM2OTgyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3b6069ccbdb40ef39ebf0f4f75cc35f7fa9f106c52b3f9aa313c834d7f603335
hovercard-subject-tagissue:5690634495
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/prometheus/client_java/2517/issue_layout
twitter:imagehttps://opengraph.githubassets.com/42b7aca1c54588b74af5e04fabc1ee59f8dcb8d1082c054ece3a6d07d04f7ede/prometheus/client_java/issues/2517
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/42b7aca1c54588b74af5e04fabc1ee59f8dcb8d1082c054ece3a6d07d04f7ede/prometheus/client_java/issues/2517
og:image:altWhen a scraper negotiates OpenMetrics 2.0 (Accept: application/openmetrics-text;version=2.0.0) without an escaping parameter, PrometheusScrapeHandler escapes UTF-8 metric and label names with Escap...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebwplotka
hostnamegithub.com
expected-hostnamegithub.com
None2b2ef9c1578c18d8ed27027940544c958743213cf4461659f14d3ccdf51e162c
turbo-cache-controlno-preview
go-importgithub.com/prometheus/client_java git https://github.com/prometheus/client_java.git
octolytics-dimension-user_id3380462
octolytics-dimension-user_loginprometheus
octolytics-dimension-repository_id7997879
octolytics-dimension-repository_nwoprometheus/client_java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7997879
octolytics-dimension-repository_network_root_nwoprometheus/client_java
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee4cce0e99cf61481a318ff12c2e8580153a6c7c6
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/prometheus/client_java/issues/2517#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprometheus%2Fclient_java%2Fissues%2F2517
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprometheus%2Fclient_java%2Fissues%2F2517
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=prometheus%2Fclient_java
Reloadhttps://github.com/prometheus/client_java/issues/2517
Reloadhttps://github.com/prometheus/client_java/issues/2517
Reloadhttps://github.com/prometheus/client_java/issues/2517
prometheushttps://github.com/prometheus
client_javahttps://github.com/prometheus/client_java
Codehttps://github.com/prometheus/client_java
Issues12 (12)https://github.com/prometheus/client_java/issues
Pull requests18 (18)https://github.com/prometheus/client_java/pulls
Actionshttps://github.com/prometheus/client_java/actions
Projectshttps://github.com/prometheus/client_java/projects
Security and qualityhttps://github.com/prometheus/client_java/security
Insightshttps://github.com/prometheus/client_java/pulse
https://github.com/prometheus/client_java
New issuehttps://github.com/login?return_to=https://github.com/prometheus/client_java/issues/2517
New issuehttps://github.com/login?return_to=https://github.com/prometheus/client_java/issues/2517
#2519https://github.com/prometheus/client_java/pull/2519
Don't escape UTF-8 names by default for OpenMetrics 2.0https://github.com/prometheus/client_java/issues/2517#top
#2519https://github.com/prometheus/client_java/pull/2519
https://github.com/bwplotka
bwplotkahttps://github.com/bwplotka
on Oct 3, 2026https://github.com/prometheus/client_java/issues/2517#issue-5690634495
https://github.com/prometheus/prometheus/blob/961c9ba40923ca4d7adf4a7a9167e56d0406df83/scrape/scrape.go#L794-L800https://github.com/prometheus/prometheus/blob/961c9ba40923ca4d7adf4a7a9167e56d0406df83/scrape/scrape.go#L794-L800
prometheus/prometheus@main...bwplotka/om2-accept-escapinghttps://github.com/prometheus/prometheus/compare/main...bwplotka/om2-accept-escaping
client_java/prometheus-metrics-config/src/main/java/io/prometheus/metrics/config/EscapingScheme.javahttps://github.com/prometheus/client_java/blob/9e9deb6b9e591c2a62b12882d8a987f120661b71/prometheus-metrics-config/src/main/java/io/prometheus/metrics/config/EscapingScheme.java#L29-L67
9e9deb6https://github.com/prometheus/client_java/commit/9e9deb6b9e591c2a62b12882d8a987f120661b71
client_java/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusScrapeHandler.javahttps://github.com/prometheus/client_java/blob/9e9deb6b9e591c2a62b12882d8a987f120661b71/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusScrapeHandler.java#L73-L91
9e9deb6https://github.com/prometheus/client_java/commit/9e9deb6b9e591c2a62b12882d8a987f120661b71
client_java/prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormats.javahttps://github.com/prometheus/client_java/blob/9e9deb6b9e591c2a62b12882d8a987f120661b71/prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormats.java#L63-L86
9e9deb6https://github.com/prometheus/client_java/commit/9e9deb6b9e591c2a62b12882d8a987f120661b71
https://github.com/prometheus/docs/blob/605cf81fefc2e8e91f8ba89bb1555ae52a43a318/docs/instrumenting/escaping_schemes.md#default-behaviorhttps://github.com/prometheus/docs/blob/605cf81fefc2e8e91f8ba89bb1555ae52a43a318/docs/instrumenting/escaping_schemes.md#default-behavior
prometheus/client_golang#2149https://github.com/prometheus/client_golang/issues/2149
zeitlingerhttps://github.com/zeitlinger
completedhttps://github.com/prometheus/client_java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
513a2d7https://github.com/prometheus/client_java/commit/513a2d79b17ec0438e823e9bce15f8635f029ca3
on Oct 6, 2026https://github.com/prometheus/client_java/issues/2517#event-32593544670
arnabnandy7https://github.com/arnabnandy7
on Oct 7, 2026https://github.com/prometheus/client_java/issues/2517#event-32675749070
fix: don't escape UTF-8 names by default for OpenMetrics 2.0 (prometh…https://github.com/arnabnandy7/client_java/commit/513a2d79b17ec0438e823e9bce15f8635f029ca3
prometh…https://github.com/prometheus/client_java/pull/2519
https://docs.github.com/articles/closing-issues-via-commit-messages
513a2d7https://github.com/arnabnandy7/client_java/commit/513a2d79b17ec0438e823e9bce15f8635f029ca3
Sign up for freehttps://github.com/signup?return_to=https://github.com/prometheus/client_java/issues/2517
Sign in to commenthttps://github.com/login?return_to=https://github.com/prometheus/client_java/issues/2517
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.