Community Patterns

Community Library Entry

1

Regular Expression
Created·2023-05-30 09:41
Flavor·Rust

r"
^(?P<metric>[a-zA-Z_:][a-zA-Z0-9_:]*]*)(?P<labels>\{.*\})?[\t ]*(?P<value>[0-9E.]*)[\t ]*(?P<timestamp>[0-9]+)?$
"
gm
Open regex in editor

Description

Prometheus exposition metric line format. Parses metric lines with named capture groups for metric name, labels, value, and timestamp. Excludes comment, type, and help lines.

https://prometheus.io/docs/instrumenting/exposition_formats/#line-format

Submitted by james-jra