MCPcopy Create free account
hub / github.com/cortexproject/cortex / maxSeriesPerMetric

Method maxSeriesPerMetric

pkg/ingester/limiter.go:220–244  ·  view source on GitHub ↗
(userID string)

Source from the content-addressed store, hash-verified

218}
219
220func (l *Limiter) maxSeriesPerMetric(userID string) int {
221 localLimit := l.limits.MaxLocalSeriesPerMetric(userID)
222 globalLimit := l.limits.MaxGlobalSeriesPerMetric(userID)
223
224 if globalLimit > 0 {
225 if l.shardByAllLabels {
226 // We can assume that series are evenly distributed across ingesters
227 // so we do convert the global limit into a local limit
228 localLimit = minNonZero(localLimit, l.convertGlobalToLocalLimit(userID, globalLimit))
229 } else {
230 // Given a metric is always pushed to the same set of ingesters (based on
231 // the replication factor), we can configure the per-ingester local limit
232 // equal to the global limit.
233 localLimit = minNonZero(localLimit, globalLimit)
234 }
235 }
236
237 // If both the local and global limits are disabled, we just
238 // use the largest int value
239 if localLimit == 0 {
240 localLimit = math.MaxInt32
241 }
242
243 return localLimit
244}
245
246func (l *Limiter) maxMetadataPerMetric(userID string) int {
247 localLimit := l.limits.MaxLocalMetadataPerMetric(userID)

Calls 4

minNonZeroFunction · 0.85

Tested by 1