(b *testing.B)
| 590 | } |
| 591 | |
| 592 | func BenchmarkCreateBuildInfo(b *testing.B) { |
| 593 | mf := &dto.MetricFamily{ |
| 594 | Name: proto.String("benchmark_build_info"), |
| 595 | Help: proto.String("Test the creation of constant 1-value build_info metric."), |
| 596 | Type: dto.MetricType_GAUGE.Enum(), |
| 597 | Metric: []*dto.Metric{ |
| 598 | { |
| 599 | Label: []*dto.LabelPair{ |
| 600 | { |
| 601 | Name: proto.String("version"), |
| 602 | Value: proto.String("1.2.3"), |
| 603 | }, |
| 604 | { |
| 605 | Name: proto.String("revision"), |
| 606 | Value: proto.String("2e84f5e4eacdffb574035810305191ff390360fe"), |
| 607 | }, |
| 608 | { |
| 609 | Name: proto.String("go_version"), |
| 610 | Value: proto.String("1.11.1"), |
| 611 | }, |
| 612 | }, |
| 613 | Gauge: &dto.Gauge{ |
| 614 | Value: proto.Float64(1), |
| 615 | }, |
| 616 | }, |
| 617 | }, |
| 618 | } |
| 619 | out := bytes.NewBuffer(make([]byte, 0, 1024)) |
| 620 | |
| 621 | for i := 0; i < b.N; i++ { |
| 622 | _, err := MetricFamilyToText(out, mf) |
| 623 | require.NoError(b, err) |
| 624 | out.Reset() |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | func TestCreateError(t *testing.T) { |
| 629 | scenarios := []struct { |
nothing calls this directly
no test coverage detected