Repository navigation
Escape exemplar label names using the negotiated scheme - #1243
Open
JackyHsu-X wants to merge 1 commit into
Open
JackyHsu-X wants to merge 1 commit into
JackyHsu-X wants to merge 1 commit into
Conversation
Signed-off-by: JackyHsu-X <xv1070733106@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Exemplar label names currently bypass the negotiated escaping scheme. For example,
Counter.inc(exemplar={'trace.id': 'abc'})is accepted but produces{trace.id="abc"}even withescaping=allow-utf-8; the OpenMetrics parser rejects that unquoted name.Use the existing
escape_label_namehelper for exemplars, passing the selected scheme through both the classic and native histogram paths. This quotes extended names forallow-utf-8and encodes them for the other schemes, consistently with sample labels. Label values keep their existing escaping.Regression coverage exercises counters, classic histograms and native histograms, both supported exposition versions, all four schemes, Unicode and quoted names, plus an unchanged legacy-name control. This changes the emitter; #1230 concerns the separate parser handling of escaped quotes.
Validation: all five installed supported CPython versions (3.10–3.14) ran the full suite: 473 passed, 14 skipped each. The final regression matrix gives 40 failures and five passing controls with the original emitter, and 45 passes with this fix. Repository flake8/isort and mypy targeting Linux pass; native Windows mypy reports the same two
process_collector.pyplatform-API errors on the original base and the fix. Actual HTTP negotiation passed 16 cases each on Windows and Linux. Optional integration skips, CPython 3.9, PyPy and macOS are not covered by that full-suite result.@csmarchbanks
AI assistance: OpenAI Codex investigated, implemented and tested this change and drafted this description. No human review is claimed.