newBenchStatsHandler builds a handler with real Prometheus vecs (same as prod).
(b *testing.B)
| 11 | |
| 12 | // newBenchStatsHandler builds a handler with real Prometheus vecs (same as prod). |
| 13 | func newBenchStatsHandler(b *testing.B) stats.Handler { |
| 14 | b.Helper() |
| 15 | reg := prometheus.NewRegistry() |
| 16 | |
| 17 | received := promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ |
| 18 | Name: "bench_received_payload_bytes", |
| 19 | Buckets: BodySizeBuckets, |
| 20 | }, []string{"method", "route"}) |
| 21 | |
| 22 | sent := promauto.With(reg).NewHistogramVec(prometheus.HistogramOpts{ |
| 23 | Name: "bench_sent_payload_bytes", |
| 24 | Buckets: BodySizeBuckets, |
| 25 | }, []string{"method", "route"}) |
| 26 | |
| 27 | inflight := promauto.With(reg).NewGaugeVec(prometheus.GaugeOpts{ |
| 28 | Name: "bench_inflight_requests", |
| 29 | }, []string{"method", "route"}) |
| 30 | |
| 31 | return NewStatsHandler(reg, received, sent, inflight, false) |
| 32 | } |
| 33 | |
| 34 | // BenchmarkHandleRPC_InPayload measures the per-message hot path for incoming |
| 35 | // payloads on a streaming RPC (the dominant case in QueryStream). |
no test coverage detected