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

Function BenchmarkDrain_TrainExtractsPatterns

pkg/drain/drain_benchmark_test.go:12–43  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

10)
11
12func BenchmarkDrain_TrainExtractsPatterns(b *testing.B) {
13 tests := []struct {
14 inputFile string
15 }{
16 {inputFile: `dev1.json`},
17 {inputFile: `ops1.json`},
18 {inputFile: `prod1.json`},
19 {inputFile: `prod2.json`},
20 {inputFile: `prod3.json`},
21 }
22
23 for _, tt := range tests {
24 b.Run(tt.inputFile, func(b *testing.B) {
25 linesJSON, err := os.ReadFile(filepath.Join("testdata", tt.inputFile))
26 require.NoError(b, err)
27
28 var lines []string
29 err = json.Unmarshal(linesJSON, &lines)
30 require.NoError(b, err)
31
32 drain := New("test-tenant", DefaultConfig())
33
34 b.ReportAllocs()
35 b.ResetTimer()
36 for i := 0; i < b.N; i++ {
37 for _, line := range lines {
38 drain.Train(line)
39 }
40 }
41 })
42 }
43}

Callers

nothing calls this directly

Calls 6

DefaultConfigFunction · 0.85
TrainMethod · 0.80
NewFunction · 0.70
JoinMethod · 0.65
UnmarshalMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected