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

Function BenchmarkCompression

prometheus/promhttp/http_test.go:552–642  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

550}
551
552func BenchmarkCompression(b *testing.B) {
553 benchmarks := []struct {
554 name string
555 compressionType string
556 }{
557 {
558 name: "test with gzip compression",
559 compressionType: "gzip",
560 },
561 {
562 name: "test with zstd compression",
563 compressionType: "zstd",
564 },
565 {
566 name: "test with no compression",
567 compressionType: "identity",
568 },
569 }
570 sizes := []struct {
571 name string
572 metricCount int
573 labelCount int
574 labelLength int
575 metricLength int
576 }{
577 {
578 name: "small",
579 metricCount: 50,
580 labelCount: 5,
581 labelLength: 5,
582 metricLength: 5,
583 },
584 {
585 name: "medium",
586 metricCount: 500,
587 labelCount: 10,
588 labelLength: 5,
589 metricLength: 10,
590 },
591 {
592 name: "large",
593 metricCount: 5000,
594 labelCount: 10,
595 labelLength: 5,
596 metricLength: 10,
597 },
598 {
599 name: "extra-large",
600 metricCount: 50000,
601 labelCount: 20,
602 labelLength: 5,
603 metricLength: 10,
604 },
605 }
606
607 for _, size := range sizes {
608 reg := prometheus.NewRegistry()
609 handler := HandlerFor(reg, HandlerOpts{})

Callers

nothing calls this directly

Calls 7

MustRegisterMethod · 0.95
NewRegistryFunction · 0.92
NewGaugeVecFunction · 0.92
HandlerForFunction · 0.85
RunMethod · 0.80
AddMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected