Skip to content

Commit

Permalink
# This is a combination of 2 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

UTF-8: Add support for parsing UTF8 metric and label names

This adds support for the new grammar of `{"metric_name", "l1"="val",}`. This grammar will also be valid for non-UTF-8 names.
UTF-8 names will not be considered valid unless model.NameValidationScheme is changed.

Signed-off-by: Owen Williams <owen.williams@grafana.com>

# The commit message prometheus#2 will be skipped:

# Restore previous behavior where spaces between label terms are acceptable in Promparse
#
# Signed-off-by: Owen Williams <owen.williams@grafana.com>
  • Loading branch information
ywwg committed Feb 15, 2024
1 parent ff6c832 commit 935d570
Show file tree
Hide file tree
Showing 14 changed files with 2,554 additions and 1,058 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ require (
)

replace (
github.com/prometheus/client_golang => /home/owilliams/src/grafana/client_golang
github.com/prometheus/common => /home/owilliams/src/third_party/common
k8s.io/klog => github.com/simonpasquier/klog-gokit v0.3.0
k8s.io/klog/v2 => github.com/simonpasquier/klog-gokit/v3 v3.3.0
)
Expand Down
1,179 changes: 1,112 additions & 67 deletions go.sum

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions model/textparse/openmetricslex.l
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,15 @@ S [ ]
<sComment>TYPE{S} l.state = sMeta1; return tType
<sComment>UNIT{S} l.state = sMeta1; return tUnit
<sComment>"EOF"\n? l.state = sInit; return tEOFWord
<sMeta1>\"(\\.|[^\\"])*\" l.state = sMeta2; return tMName
<sMeta1>{M}({M}|{D})* l.state = sMeta2; return tMName
<sMeta2>{S}{C}*\n l.state = sInit; return tText
{M}({M}|{D})* l.state = sValue; return tMName
<sValue>\{ l.state = sLabels; return tBraceOpen
\{ l.state = sLabels; return tBraceOpen
<sLabels>{L}({L}|{D})* return tLName
<sLabels>\"(\\.|[^\\"])*\" l.state = sLabels; return tQString
<sLabels>\} l.state = sValue; return tBraceClose
<sLabels>= l.state = sLValue; return tEqual
<sLabels>, return tComma
Expand Down

0 comments on commit 935d570

Please sign in to comment.