prometheus / common

Go libraries shared across Prometheus components and libraries.
Apache License 2.0
259 stars 306 forks source link

Support for: INFO type #622

Open maestroi opened 2 months ago

maestroi commented 2 months ago

Hi Valuable opensource contributer.

I'm trying to parse a prometheus endpoint from a program, unfortunately it has a INFO as first metric. This will just errors the complete parsing of all metrics, which in turn give me no map of metrics to work with.

Are there plants to add this in the library or a plan to just skip those non supported metrics?

Version: github.com/prometheus/common v0.52.3

Import: github.com/prometheus/common/expfmt

Feature supported according to docs: No

No support for the following (optional) features: info type, stateset type, gaugehistogram type.

Error: text format parsing error in line 2: unknown metric type "info"

Code: func ParseMetricFamily(body string) (map[string]*dto.MetricFamily, error) { var parser expfmt.TextParser mf, err := parser.TextToMetricFamilies(strings.NewReader(body)) fmt.Println(mf) if err != nil { fmt.Println(err) return nil, err } return mf, nil }