feat(go): expose gateway frame duration histogram
This commit is contained in:
@@ -46,6 +46,27 @@ func TestRegistryRendersGaugesWithLabels(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistryObservesHistogramBuckets(t *testing.T) {
|
||||
registry := NewRegistry()
|
||||
|
||||
registry.ObserveHistogram("vehicle_gateway_frame_duration_ms", Labels{"protocol": "JT808"}, []float64{1, 5, 10}, 7)
|
||||
|
||||
text := registry.Render()
|
||||
for _, want := range []string{
|
||||
`# TYPE vehicle_gateway_frame_duration_ms histogram`,
|
||||
`vehicle_gateway_frame_duration_ms_bucket{le="1",protocol="JT808"} 0`,
|
||||
`vehicle_gateway_frame_duration_ms_bucket{le="5",protocol="JT808"} 0`,
|
||||
`vehicle_gateway_frame_duration_ms_bucket{le="10",protocol="JT808"} 1`,
|
||||
`vehicle_gateway_frame_duration_ms_bucket{le="+Inf",protocol="JT808"} 1`,
|
||||
`vehicle_gateway_frame_duration_ms_count{protocol="JT808"} 1`,
|
||||
`vehicle_gateway_frame_duration_ms_sum{protocol="JT808"} 7`,
|
||||
} {
|
||||
if !strings.Contains(text, want) {
|
||||
t.Fatalf("histogram missing %s:\n%s", want, text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistryRecordsKafkaLagGauge(t *testing.T) {
|
||||
registry := NewRegistry()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user