(series map[uint64]*T, hash uint64, lbls labels.Labels, lifecycler Limiter, count uint32)
| 88 | } |
| 89 | |
| 90 | func resolveSeries[T any](series map[uint64]*T, hash uint64, lbls labels.Labels, lifecycler Limiter, count uint32) (*T, labels.Labels, uint64) { |
| 91 | // If we already track the series, return it. |
| 92 | if existing, ok := series[hash]; ok { |
| 93 | return existing, lbls, hash |
| 94 | } |
| 95 | |
| 96 | // Otherwise, we need to let the lifecycler decide which labels to use |
| 97 | lbls, hash = lifecycler.OnAdd(hash, count, lbls) |
| 98 | |
| 99 | // The lifecycler may have changed the labels, so we need to check again. |
| 100 | if existing, ok := series[hash]; ok { |
| 101 | return existing, lbls, hash |
| 102 | } |
| 103 | |
| 104 | // Finally, we may still have a new series, so it will need to be created by the caller. |
| 105 | return nil, lbls, hash |
| 106 | } |
| 107 | |
| 108 | func (c *counter) newSeries(lbls labels.Labels, value float64) *counterSeries { |
| 109 | return &counterSeries{ |
no test coverage detected