MCPcopy
hub / github.com/prometheus/pushgateway / WipeMetricStore

Function WipeMetricStore

handler/wipe.go:27–45  ·  view source on GitHub ↗

WipeMetricStore deletes all the metrics in MetricStore. The returned handler is already instrumented for Prometheus.

(
	ms storage.MetricStore,
	logger *slog.Logger)

Source from the content-addressed store, hash-verified

25//
26// The returned handler is already instrumented for Prometheus.
27func WipeMetricStore(
28 ms storage.MetricStore,
29 logger *slog.Logger) http.Handler {
30
31 return InstrumentWithCounter(
32 "wipe",
33 http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
34 w.WriteHeader(http.StatusAccepted)
35 logger.Debug("start wiping metric store")
36 // Delete all metric groups by sending write requests with MetricFamilies equal to nil.
37 for _, group := range ms.GetMetricFamiliesMap() {
38 ms.SubmitWriteRequest(storage.WriteRequest{
39 Labels: group.Labels,
40 Timestamp: time.Now(),
41 })
42 }
43
44 }))
45}

Callers 2

mainFunction · 0.92
TestWipeMetricStoreFunction · 0.85

Calls 3

InstrumentWithCounterFunction · 0.85
GetMetricFamiliesMapMethod · 0.65
SubmitWriteRequestMethod · 0.65

Tested by 1

TestWipeMetricStoreFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…