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

Function BenchmarkCreate

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

Source from the content-addressed store, hash-verified

590}
591
592func BenchmarkCreate(b *testing.B) {
593 mf := &dto.MetricFamily{
594 Name: proto.String("request_duration_microseconds"),
595 Help: proto.String("The response latency."),
596 Type: dto.MetricType_HISTOGRAM.Enum(),
597 Metric: []*dto.Metric{
598 {
599 Label: []*dto.LabelPair{
600 {
601 Name: proto.String("name_1"),
602 Value: proto.String("val with\nnew line"),
603 },
604 {
605 Name: proto.String("name_2"),
606 Value: proto.String("val with \\backslash and \"quotes\""),
607 },
608 {
609 Name: proto.String("name_3"),
610 Value: proto.String("Just a quite long label value to test performance."),
611 },
612 },
613 Histogram: &dto.Histogram{
614 SampleCount: proto.Uint64(2693),
615 SampleSum: proto.Float64(1756047.3),
616 Bucket: []*dto.Bucket{
617 {
618 UpperBound: proto.Float64(100),
619 CumulativeCount: proto.Uint64(123),
620 },
621 {
622 UpperBound: proto.Float64(120),
623 CumulativeCount: proto.Uint64(412),
624 },
625 {
626 UpperBound: proto.Float64(144),
627 CumulativeCount: proto.Uint64(592),
628 },
629 {
630 UpperBound: proto.Float64(172.8),
631 CumulativeCount: proto.Uint64(1524),
632 },
633 {
634 UpperBound: proto.Float64(math.Inf(+1)),
635 CumulativeCount: proto.Uint64(2693),
636 },
637 },
638 },
639 },
640 {
641 Label: []*dto.LabelPair{
642 {
643 Name: proto.String("name_1"),
644 Value: proto.String("Björn"),
645 },
646 {
647 Name: proto.String("name_2"),
648 Value: proto.String("佖佥"),
649 },

Callers

nothing calls this directly

Calls 2

MetricFamilyToTextFunction · 0.85
StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…