| 47 | } |
| 48 | |
| 49 | func NewDrainSanitizer(tenant string, sanitizeModeF sanitizeModeFunc, staleDuration time.Duration) *DrainSanitizer { |
| 50 | return &DrainSanitizer{ |
| 51 | drain: drain.New(tenant, drain.DefaultConfig()), |
| 52 | tenant: tenant, |
| 53 | sanitizeModeF: sanitizeModeF, |
| 54 | metricTotalSpansSanitized: metricTotalSpansSanitized.WithLabelValues(tenant), |
| 55 | demand: NewCardinality(staleDuration, removeStaleSeriesInterval), |
| 56 | demandGauge: metricPostSanitizationDemand.WithLabelValues(tenant), |
| 57 | demandUpdateChan: time.Tick(15 * time.Second), |
| 58 | pruneChan: time.Tick(5 * time.Minute), |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | func (s *DrainSanitizer) Sanitize(lbls labels.Labels) labels.Labels { |
| 63 | // Check the override at runtime so that changes to the sanitization mode override |