MCPcopy Create free account
hub / github.com/cortexproject/cortex / cleanupInactiveUser

Method cleanupInactiveUser

pkg/distributor/distributor.go:522–549  ·  view source on GitHub ↗
(userID string)

Source from the content-addressed store, hash-verified

520}
521
522func (d *Distributor) cleanupInactiveUser(userID string) {
523 d.ingestersRing.CleanupShuffleShardCache(userID)
524
525 d.HATracker.CleanupHATrackerMetricsForUser(userID)
526
527 d.receivedSamples.DeleteLabelValues(userID, sampleMetricTypeFloat)
528 d.receivedSamples.DeleteLabelValues(userID, sampleMetricTypeHistogram)
529 d.receivedSamples.DeleteLabelValues(userID, sampleMetricTypeHistogramNHCB)
530 d.receivedExemplars.DeleteLabelValues(userID)
531 d.receivedMetadata.DeleteLabelValues(userID)
532 d.incomingSamples.DeleteLabelValues(userID, sampleMetricTypeFloat)
533 d.incomingSamples.DeleteLabelValues(userID, sampleMetricTypeHistogram)
534 d.incomingSamples.DeleteLabelValues(userID, sampleMetricTypeHistogramNHCB)
535 d.incomingExemplars.DeleteLabelValues(userID)
536 d.incomingMetadata.DeleteLabelValues(userID)
537 d.nonHASamples.DeleteLabelValues(userID)
538 d.latestSeenSampleTimestampPerUser.DeleteLabelValues(userID)
539
540 if err := util.DeleteMatchingLabels(d.dedupedSamples, map[string]string{"user": userID}); err != nil {
541 level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_deduped_samples_total metric for user", "user", userID, "err", err)
542 }
543
544 if err := util.DeleteMatchingLabels(d.receivedSamplesPerLabelSet, map[string]string{"user": userID}); err != nil {
545 level.Warn(d.log).Log("msg", "failed to remove cortex_distributor_received_samples_per_labelset_total metric for user", "user", userID, "err", err)
546 }
547
548 validation.DeletePerUserValidationMetrics(d.validateMetrics, userID, d.log)
549}
550
551// Called after distributor is asked to stop via StopAsync.
552func (d *Distributor) stopping(_ error) error {

Calls 5

DeleteMatchingLabelsFunction · 0.92
LogMethod · 0.45