Skip to content

[probes.external] Make payload labels parsing more robust. - #976

Merged
manugarg merged 7 commits into
mainfrom
ext_labels_951
Jan 27, 2025
Merged

manugarg merged 7 commits into
mainfrom
ext_labels_951

Conversation

@manugarg

@manugarg manugarg commented Jan 26, 2025 •

Copy link
Copy Markdown
Contributor

Instead of splitting label line at , and then parsing parts into key-values, do a more methodical parsing:

  • Read keys until = and enforce prometheus validity criteria on key characters (alpha-numeric and _).
  • For values, consider the following cases:
    • If value starts with ", it's a quoted string and read until next ", while taking into account escaped characters, including a \".
    • If value doesn't start with ", it's an unquoted string. Unquoted strings can contain only alpha-numeric characters and -, _, . (this is to cause less surprises for existing users, in case someone is exporting domain names as values).
    • Values should either end with , or be the last value in the line.

@manugarg
manugarg merged commit ba0c8f0 into main Jan 27, 2025
@manugarg
manugarg deleted the ext_labels_951 branch January 27, 2025 22:22
@manugarg manugarg added this to the v0.14.0 milestone Feb 4, 2025
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

Successfully merging this pull request may close these issues.

1 participant