Track accepts userID, label set and hash of the label set limit.
(userId string, hash uint64, labelSet labels.Labels)
| 36 | |
| 37 | // Track accepts userID, label set and hash of the label set limit. |
| 38 | func (m *LabelSetTracker) Track(userId string, hash uint64, labelSet labels.Labels) { |
| 39 | s := m.shards[util.HashFP(model.Fingerprint(hash))%numMetricShards] |
| 40 | s.Lock() |
| 41 | if userEntry, ok := s.userLabelSets[userId]; ok { |
| 42 | if _, ok2 := userEntry[hash]; !ok2 { |
| 43 | userEntry[hash] = labelSet |
| 44 | } |
| 45 | } else { |
| 46 | s.userLabelSets[userId] = map[uint64]labels.Labels{hash: labelSet} |
| 47 | } |
| 48 | // Unlock before we update metrics. |
| 49 | s.Unlock() |
| 50 | } |
| 51 | |
| 52 | // UpdateMetrics cleans up dangling user and label set from the tracker as well as metrics. |
| 53 | // It takes a function for user to customize the metrics cleanup logic when either a user or |