Skip to content

Commit

Permalink
get cat once out of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ying-jeanne committed Dec 30, 2024
1 parent 9c4c2df commit f8f2a49
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1829,10 +1829,11 @@ func tokenForMetadata(userID string, metricName string) uint32 {

func (d *Distributor) updateReceivedMetrics(req *mimirpb.WriteRequest, userID string) {
var receivedSamples, receivedExemplars, receivedMetadata int
cat := d.costAttributionMgr.Tracker(userID)
for _, ts := range req.Timeseries {
receivedSamples += len(ts.TimeSeries.Samples) + len(ts.TimeSeries.Histograms)
receivedExemplars += len(ts.TimeSeries.Exemplars)
d.costAttributionMgr.Tracker(userID).IncrementReceivedSamples(ts.Labels, float64(receivedSamples), mtime.Now())
cat.IncrementReceivedSamples(ts.Labels, float64(receivedSamples), mtime.Now())
}
receivedMetadata = len(req.Metadata)

Expand Down

0 comments on commit f8f2a49

Please sign in to comment.