Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ying-jeanne committed Jan 24, 2025
1 parent 50f630c commit a8b37f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 5 additions & 4 deletions pkg/costattribution/active_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ type ActiveSeriesTracker struct {
activeSeriesPerUserAttribution *prometheus.Desc
logger log.Logger

labels []string
overflowLabels []string
labels []string
overflowLabels []string

maxCardinality int
cooldownDuration time.Duration

Expand Down Expand Up @@ -61,12 +62,12 @@ func newActiveSeriesTracker(userID string, trackedLabels []string, limit int, co
cooldownDuration: cooldownDuration,
}

labelsWithPrefix := slices.Clone(trackedLabels)
labelsWithPrefix = addLabelsPrefix(labelsWithPrefix)
labelsWithPrefix := addLabelsPrefix(trackedLabels)
labelsWithPrefix = append(labelsWithPrefix, tenantLabel)
ast.activeSeriesPerUserAttribution = prometheus.NewDesc("cortex_ingester_attributed_active_series",
"The total number of active series per user and attribution.", labelsWithPrefix,
prometheus.Labels{trackerLabel: defaultTrackerName})

return ast
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/costattribution/sample_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ func newSampleTracker(userID string, trackedLabels []string, limit int, cooldown
overflowCounter: observation{},
}

labelsWithPrefix := slices.Clone(trackedLabels)
labelsWithPrefix = addLabelsPrefix(labelsWithPrefix)
labelsWithPrefix := addLabelsPrefix(trackedLabels)
labelsWithPrefix = append(labelsWithPrefix, tenantLabel, "reason")

tracker.discardedSampleAttribution = prometheus.NewDesc("cortex_discarded_attributed_samples_total",
Expand Down

0 comments on commit a8b37f5

Please sign in to comment.