Skip to content
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

[WIP] Otlp: Add info metrics identifiers labels in open metrics specification #650

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion model/textparse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ In the rare case that you need to update the textparse lexers, edit promlex.l or
`golex -o=promlex.l.go promlex.l`

Note that you need golex installed:
`go get -u modernc.org/golex`
`go install -u modernc.org/golex@latest`
3 changes: 3 additions & 0 deletions model/textparse/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ type Parser interface {
// The returned byte slices become invalid after the next call to Next.
Unit() ([]byte, []byte)

// IdentifyingLabels returns the identifying labels for info metrics
IdentifyingLabels() []string

// Comment returns the text of the current comment.
// Must only be called after Next returned a comment entry.
// The returned byte slice becomes invalid after the next call to Next.
Expand Down
11 changes: 8 additions & 3 deletions model/textparse/openmetricslex.l
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ func (l *openMetricsLexer) Lex() token {
D [0-9]
L [a-zA-Z_]
M [a-zA-Z_:]
C [^\n]
C [^\n()]
S [ ]

%x sComment sMeta1 sMeta2 sLabels sLValue sValue sTimestamp sExemplar sEValue sETimestamp
%x sComment sMeta1 sMeta2 sLabels sLValue sValue sTimestamp sExemplar sEValue sETimestamp sIdens

%yyc c
%yyn c = l.next()
Expand All @@ -52,7 +52,12 @@ S [ ]
<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
<sMeta2>{S}{C}* l.state = sMeta2; return tText
<sMeta2>\( l.state = sIdens; return tParentOpen
<sIdens>{L}({L}|{D})* return tLName
<sIdens>, return tComma
<sIdens>\) l.state = sMeta2; return tParentClose
<sMeta2>\n l.state = sInit; return tLinebreak

{M}({M}|{D})* l.state = sValue; return tMName
<sValue>\{ l.state = sLabels; return tBraceOpen
Expand Down
Loading
Loading