Skip to content

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

Closed
@wissamir

Description

@wissamir

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions