MCPcopy
hub / github.com/grafana/tempo / getPartitionLagSecondsFromGatherer

Function getPartitionLagSecondsFromGatherer

modules/livestore/live_store_test.go:572–600  ·  view source on GitHub ↗

getPartitionLagSecondsFromGatherer reads the tempo_ingest_group_partition_lag_seconds gauge from the default Prometheus gatherer.

(t *testing.T, group, partition string)

Source from the content-addressed store, hash-verified

570// getPartitionLagSecondsFromGatherer reads the tempo_ingest_group_partition_lag_seconds gauge
571// from the default Prometheus gatherer.
572func getPartitionLagSecondsFromGatherer(t *testing.T, group, partition string) float64 {
573 t.Helper()
574
575 families, err := prometheus.DefaultGatherer.Gather()
576 require.NoError(t, err)
577
578 for _, f := range families {
579 if f.GetName() != "tempo_ingest_group_partition_lag_seconds" {
580 continue
581 }
582 for _, m := range f.GetMetric() {
583 var matchGroup, matchPartition bool
584 for _, l := range m.GetLabel() {
585 if l.GetName() == "group" && l.GetValue() == group {
586 matchGroup = true
587 }
588 if l.GetName() == "partition" && l.GetValue() == partition {
589 matchPartition = true
590 }
591 }
592 if matchGroup && matchPartition {
593 return m.GetGauge().GetValue()
594 }
595 }
596 }
597
598 t.Fatalf("metric tempo_ingest_group_partition_lag_seconds{group=%q, partition=%q} not found", group, partition)
599 return 0
600}
601
602func TestLiveStoreUsesRecordTimestampForBlockStartAndEnd(t *testing.T) {
603 // default ingestion slack is 2 minutes. create some convenient times to help the test below

Calls 2

GetNameMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected