MCPcopy Index your code
hub / github.com/coder/coder / RegistryDump

Function RegistryDump

coderd/coderdtest/promhelp/metrics.go:21–30  ·  view source on GitHub ↗

RegistryDump returns the http page for a given registry's metrics. Very useful for visual debugging.

(reg *prometheus.Registry)

Source from the content-addressed store, hash-verified

19// RegistryDump returns the http page for a given registry's metrics.
20// Very useful for visual debugging.
21func RegistryDump(reg *prometheus.Registry) string {
22 h := promhttp.HandlerFor(reg, promhttp.HandlerOpts{})
23 rec := httptest.NewRecorder()
24 req, _ := http.NewRequestWithContext(context.Background(), http.MethodGet, "/", nil)
25 h.ServeHTTP(rec, req)
26 resp := rec.Result()
27 data, _ := io.ReadAll(resp.Body)
28 _ = resp.Body.Close()
29 return string(data)
30}
31
32// Compare can be used to compare a registry to some prometheus formatted
33// text. If any values differ, an error is returned.

Callers 2

TestInstrumentFunction · 0.92
TestGithubRateLimitsFunction · 0.92

Calls 4

CloseMethod · 0.65
ServeHTTPMethod · 0.45
ResultMethod · 0.45
ReadAllMethod · 0.45

Tested by 2

TestInstrumentFunction · 0.74
TestGithubRateLimitsFunction · 0.74