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

Function TestQueryMetrics

cmd/tempo-vulture/main_test.go:620–797  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

618}
619
620func TestQueryMetrics(t *testing.T) {
621 seed := time.Date(2008, 1, 1, 12, 0, 0, 0, time.UTC)
622
623 config := vultureConfiguration{
624 tempoOrgID: "orgID",
625 tempoWriteBackoffDuration: time.Second,
626 tempoSearchBackoffDuration: time.Second,
627 }
628
629 info := util.NewTraceInfo(seed, config.tempoOrgID)
630 hexID := info.HexID()
631
632 successMetricsResponse := &tempopb.QueryRangeResponse{
633 Series: []*tempopb.TimeSeries{
634 {
635 Samples: []tempopb.Sample{
636 {
637 TimestampMs: seed.UnixMilli(),
638 Value: 2.0,
639 },
640 },
641 },
642 },
643 }
644
645 tests := []struct {
646 name string
647 response *tempopb.QueryRangeResponse
648 searchResponse []*tempopb.TraceSearchMetadata
649 err error
650 expectedMetrics traceMetrics
651 expectedError string
652 }{
653 {
654 name: "successful metrics query: 1 trace, 2 spans",
655 response: successMetricsResponse,
656 searchResponse: []*tempopb.TraceSearchMetadata{
657 {
658 SpanSets: []*tempopb.SpanSet{
659 {
660 Matched: 2,
661 },
662 },
663 },
664 },
665 expectedMetrics: traceMetrics{
666 requested: 1,
667 },
668 },
669 {
670 name: "successful metrics query: 2 traces, 1 span each",
671 response: successMetricsResponse,
672 searchResponse: []*tempopb.TraceSearchMetadata{
673 {
674 SpanSets: []*tempopb.SpanSet{
675 {
676 Matched: 1,
677 },

Callers

nothing calls this directly

Calls 6

HexIDMethod · 0.95
NewTraceInfoFunction · 0.92
queryMetricsFunction · 0.85
ErrorMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected