Repository navigation
Preserve unit metadata in restricted registries - #1237
Open
Aryangupta-05 wants to merge 1 commit into
Open
Aryangupta-05 wants to merge 1 commit into
Aryangupta-05 wants to merge 1 commit into
Conversation
Keep the original unit when creating a metric snapshot with selected samples. Cover the restricted registry object and the OpenMetrics WSGI response for name[] filtering. Assisted-by: OpenAI Codex Signed-off-by: Aryan <aryangupta050903@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.
Filtering a registry drops each metric's unit. For example, an OpenMetrics response for
?name[]=response_size_bytes_totalkeeps the counter sample but loses# UNIT response_size_bytes bytes. The same metric has its unit when collected without the filter.Metric._restricted_metric()copies the name, help text and type into a newMetric, but omitsself.unit. Pass that existing metadata through to the snapshot. Selected samples and their values remain unchanged.Added regressions for a restricted summary and the public WSGI application's filtered OpenMetrics response. Both fail on unchanged master (
ff9a2d3) and pass with the fix.Validation on Windows / Python 3.12.15:
tox -e py3.12: 430 passed, 14 skipped.tox -e flake8: passes;tox -e isort: passes.--platform linux --install-types --non-interactive: no issues in 42 source files.The skips concern optional integrations/dependencies. Other Python versions and operating systems were not run locally.
The default Windows-targeted mypy run reports two unavailable POSIX attributes in the unchanged
process_collector.py:resource.getpagesizeandos.sysconf. The Linux-targeted check above passes without changing that file or the project's type-check configuration.@csmarchbanks, this is a small correction to preserve existing metadata during sample filtering, following the contribution guide.
AI assistance: OpenAI Codex helped investigate, implement and test this change. The commit is signed off under the DCO.