8000 [BUG] Prometheus parser 0.22.0 does not early skip comment lines · Issue #1108 · prometheus/client_python · GitHub
[go: up one dir, main page]

Skip to content

[BUG] Prometheus parser 0.22.0 does not early skip comment lines #1108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wissamir opened this issue May 27, 2025 · 1 comment
Closed

[BUG] Prometheus parser 0.22.0 does not early skip comment lines #1108

wissamir opened this issue May 27, 2025 · 1 comment

Comments

@wissamir
Copy link
Contributor
wissamir commented May 27, 2025

Issue

Starting with version 0.22.0, comment lines do not skip validation and parsing early enough and third token goes into _is_valid_legacy_metric_name which results with an error when it does not match the METRIC_NAME_RE

Example:

"""# A random comment which goes into validation and passes"""
"""# Another random. comment which goes into validation and fails"""
"""# Whatever 335/125 random comment which goes into validation and fails"""

Expected behaviour:
Skip all comment lines. list(text_string_to_metric_families) should result with empty list []

Current behaviour:
A ValueError is raised for the second and third comment lines above

I'll be pushing a PR for the fix

wissamir added a commit to wissamir/client_python that referenced this issue May 27, 2025
Signed-off-by: Wissam Abu Ahmad <xy.wissam@gmail.com>
wissamir added a commit to wissamir/client_python that referenced this issue May 27, 2025
)

Signed-off-by: Wissam Abu Ahmad <xy.wissam@gmail.com>
@wissamir
Copy link
Contributor Author

Fix proposal PR #1109

wissamir added a commit to wissamir/client_python that referenced this issue May 28, 2025
)

Signed-off-by: Wissam Abu Ahmad <wabuahma@redhat.com>
csmarchbanks pushed a commit that referenced this issue May 28, 2025
Signed-off-by: Wissam Abu Ahmad <wabuahma@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0