(b *testing.B)
| 19 | ) |
| 20 | |
| 21 | func BenchmarkCounter(b *testing.B) { |
| 22 | type fns []func(*CounterVec) Counter |
| 23 | |
| 24 | twoConstraint := func(_ string) string { |
| 25 | return "two" |
| 26 | } |
| 27 | |
| 28 | deLV := func(m *CounterVec) Counter { |
| 29 | return m.WithLabelValues("eins", "zwei", "drei") |
| 30 | } |
| 31 | frLV := func(m *CounterVec) Counter { |
| 32 | return m.WithLabelValues("une", "deux", "trois") |
| 33 | } |
| 34 | nlLV := func(m *CounterVec) Counter { |
| 35 | return m.WithLabelValues("een", "twee", "drie") |
| 36 | } |
| 37 | |
| 38 | deML := func(m *CounterVec) Counter { |
| 39 | return m.With(Labels{"two": "zwei", "one": "eins", "three": "drei"}) |
| 40 | } |
| 41 | frML := func(m *CounterVec) Counter { |
| 42 | return m.With(Labels{"two": "deux", "one": "une", "three": "trois"}) |
| 43 | } |
| 44 | nlML := func(m *CounterVec) Counter { |
| 45 | return m.With(Labels{"two": "twee", "one": "een", "three": "drie"}) |
| 46 | } |
| 47 | |
| 48 | deLabels := Labels{"two": "zwei", "one": "eins", "three": "drei"} |
| 49 | dePML := func(m *CounterVec) Counter { |
| 50 | return m.With(deLabels) |
| 51 | } |
| 52 | frLabels := Labels{"two": "deux", "one": "une", "three": "trois"} |
| 53 | frPML := func(m *CounterVec) Counter { |
| 54 | return m.With(frLabels) |
| 55 | } |
| 56 | nlLabels := Labels{"two": "twee", "one": "een", "three": "drie"} |
| 57 | nlPML := func(m *CounterVec) Counter { |
| 58 | return m.With(nlLabels) |
| 59 | } |
| 60 | |
| 61 | table := []struct { |
| 62 | name string |
| 63 | constraint LabelConstraint |
| 64 | counters fns |
| 65 | }{ |
| 66 | {"With Label Values", nil, fns{deLV}}, |
| 67 | {"With Label Values and Constraint", twoConstraint, fns{deLV}}, |
| 68 | {"With triple Label Values", nil, fns{deLV, frLV, nlLV}}, |
| 69 | {"With triple Label Values and Constraint", twoConstraint, fns{deLV, frLV, nlLV}}, |
| 70 | {"With repeated Label Values", nil, fns{deLV, deLV}}, |
| 71 | {"With repeated Label Values and Constraint", twoConstraint, fns{deLV, deLV}}, |
| 72 | {"With Mapped Labels", nil, fns{deML}}, |
| 73 | {"With Mapped Labels and Constraint", twoConstraint, fns{deML}}, |
| 74 | {"With triple Mapped Labels", nil, fns{deML, frML, nlML}}, |
| 75 | {"With triple Mapped Labels and Constraint", twoConstraint, fns{deML, frML, nlML}}, |
| 76 | {"With repeated Mapped Labels", nil, fns{deML, deML}}, |
| 77 | {"With repeated Mapped Labels and Constraint", twoConstraint, fns{deML, deML}}, |
| 78 | {"With Prepared Mapped Labels", nil, fns{dePML}}, |
nothing calls this directly
no test coverage detected