Hi,
Great Tool thank you!
I have a bash script which create two labels, something like:
function gauge_vector(){
jq -n
--arg value "${1}"
--arg stream_id "${2}"
'{
"value": $value | tonumber,
"labels": {
"labelX": foo,
"labelY": bar
}
}'
}
When running the binary I get:
go run exporter.go
{"level":"debug","time":"2021-07-17T19:29:45Z","message":"start exporter"}
panic: inconsistent label cardinality: expected 1 label values but got 2 in prometheus.Labels{"labelY":"bar", "labelX":"foo"}
goroutine 22 [running]:
github.com/prometheus/client_golang/prometheus.(*GaugeVec).With(0xc0000a22b8, 0xc00015c6f0, 0xc0000a11b0, 0xe)
/root/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/gauge.go:228 +0xc2
github.com/dodopizza/prometheus-shell-exporter/internal/shell-exporter/go.(*Collector).Collect(0xc00008bf80, 0xc000078240)
/tmp/9/prometheus-shell-exporter/internal/shell-exporter/go/collector.go:84 +0x2b0
github.com/prometheus/client_golang/prometheus.DescribeByCollect.func1(0xa5fee0, 0xc00008bf80, 0xc000078240)
/root/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/collector.go:90 +0x3b
created by github.com/prometheus/client_golang/prometheus.DescribeByCollect
/root/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/collector.go:89 +0x75
exit status 2
Is it possible to fix this?
Thank you