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

Function TestMiddlewareAPI

prometheus/promhttp/instrument_server_test.go:416–426  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

414}
415
416func TestMiddlewareAPI(t *testing.T) {
417 chain, reg := makeInstrumentedHandler(func(w http.ResponseWriter, r *http.Request) {
418 _, _ = w.Write([]byte("OK"))
419 })
420
421 r, _ := http.NewRequest(http.MethodGet, "www.example.com", nil)
422 w := httptest.NewRecorder()
423 chain.ServeHTTP(w, r)
424
425 assetMetricAndExemplars(t, reg, 5, nil)
426}
427
428func TestMiddlewareAPI_WithExemplars(t *testing.T) {
429 exemplar := prometheus.Labels{"traceID": "example situation observed by this metric"}

Callers

nothing calls this directly

Calls 4

makeInstrumentedHandlerFunction · 0.85
assetMetricAndExemplarsFunction · 0.85
WriteMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected