swift-prometheus icon indicating copy to clipboard operation
swift-prometheus copied to clipboard

Use of dimensions produces empty metric

Open freef4ll opened this issue 2 years ago • 0 comments

If one creates a Gauge or a Counter with dimensions, an exported value actually contains 2 metrics, this when visualized in Grafana will also result in 2 graphs, one which displays the initial 0 value and one with the actual metric:

let g = Gauge(label: "test_gauge", dimensions: [("abc", "123")])
g.record(10)

This will produce the output of:

# TYPE test counter
test_gauge 0
test_gauge{abc="123"} 10

The issue is slightly touched on in https://github.com/swift-server-community/SwiftPrometheus/issues/77

Potential fix/workaround might be https://github.com/swift-server-community/SwiftPrometheus/compare/master...ordo-one:SwiftPrometheus:gauge_label

freef4ll avatar Nov 22 '22 20:11 freef4ll