MCPcopy
hub / github.com/prometheus/client_golang / benchmarkMetricVecWith

Function benchmarkMetricVecWith

prometheus/vec_test.go:959–978  ·  view source on GitHub ↗
(b *testing.B, labels map[string]string)

Source from the content-addressed store, hash-verified

957}
958
959func benchmarkMetricVecWith(b *testing.B, labels map[string]string) {
960 var keys []string
961 for k := range labels {
962 keys = append(keys, k)
963 }
964
965 vec := NewGaugeVec(
966 GaugeOpts{
967 Name: "test",
968 Help: "helpless",
969 },
970 keys,
971 )
972
973 b.ReportAllocs()
974 b.ResetTimer()
975 for i := 0; i < b.N; i++ {
976 vec.With(labels)
977 }
978}
979
980func benchmarkMetricVecWithLabelValues(b *testing.B, labels map[string][]string) {
981 var keys []string

Callers 1

Calls 2

WithMethod · 0.95
NewGaugeVecFunction · 0.70

Tested by

no test coverage detected