MCPcopy Create free account
hub / github.com/prometheus/common / BenchmarkCreate

Function BenchmarkCreate

expfmt/text_create_test.go:359–457  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

357}
358
359func BenchmarkCreate(b *testing.B) {
360 mf := &dto.MetricFamily{
361 Name: proto.String("request_duration_microseconds"),
362 Help: proto.String("The response latency."),
363 Type: dto.MetricType_HISTOGRAM.Enum(),
364 Metric: []*dto.Metric{
365 {
366 Label: []*dto.LabelPair{
367 {
368 Name: proto.String("name_1"),
369 Value: proto.String("val with\nnew line"),
370 },
371 {
372 Name: proto.String("name_2"),
373 Value: proto.String("val with \\backslash and \"quotes\""),
374 },
375 {
376 Name: proto.String("name_3"),
377 Value: proto.String("Just a quite long label value to test performance."),
378 },
379 },
380 Histogram: &dto.Histogram{
381 SampleCount: proto.Uint64(2693),
382 SampleSum: proto.Float64(1756047.3),
383 Bucket: []*dto.Bucket{
384 {
385 UpperBound: proto.Float64(100),
386 CumulativeCount: proto.Uint64(123),
387 },
388 {
389 UpperBound: proto.Float64(120),
390 CumulativeCount: proto.Uint64(412),
391 },
392 {
393 UpperBound: proto.Float64(144),
394 CumulativeCount: proto.Uint64(592),
395 },
396 {
397 UpperBound: proto.Float64(172.8),
398 CumulativeCount: proto.Uint64(1524),
399 },
400 {
401 UpperBound: proto.Float64(math.Inf(+1)),
402 CumulativeCount: proto.Uint64(2693),
403 },
404 },
405 },
406 },
407 {
408 Label: []*dto.LabelPair{
409 {
410 Name: proto.String("name_1"),
411 Value: proto.String("Björn"),
412 },
413 {
414 Name: proto.String("name_2"),
415 Value: proto.String("佖佥"),
416 },

Callers

nothing calls this directly

Calls 2

MetricFamilyToTextFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected