WipeMetricStore deletes all the metrics in MetricStore. The returned handler is already instrumented for Prometheus.
( ms storage.MetricStore, logger *slog.Logger)
| 25 | // |
| 26 | // The returned handler is already instrumented for Prometheus. |
| 27 | func 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 | } |
searching dependent graphs…