Skip to content

Update seriesFlushReason when flushing, not enqueing. #2802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* `cortex_bucket_stores_gate_queries_concurrent_max`
* `cortex_bucket_stores_gate_queries_in_flight`
* `cortex_bucket_stores_gate_duration_seconds`
* [CHANGE] Metric `cortex_ingester_flush_reasons` has been renamed to `cortex_ingester_series_flush_reasons`, and is now incremented during flush, not when series is enqueued for flushing. #2802
* [FEATURE] Introduced `ruler.for-outage-tolerance`, Max time to tolerate outage for restoring "for" state of alert. #2783
* [FEATURE] Introduced `ruler.for-grace-period`, Minimum duration between alert and restored "for" state. This is maintained only for alerts with configured "for" time greater than grace period. #2783
* [FEATURE] Introduced `ruler.resend-delay`, Minimum amount of time to wait before resending an alert to Alertmanager. #2783
Expand Down
3 changes: 2 additions & 1 deletion pkg/ingester/flush.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ func (i *Ingester) sweepSeries(userID string, fp model.Fingerprint, series *memo

flushQueueIndex := int(uint64(fp) % uint64(i.cfg.ConcurrentFlushes))
if i.flushQueues[flushQueueIndex].Enqueue(&flushOp{firstTime, userID, fp, immediate}) {
i.metrics.flushReasons.WithLabelValues(flush.String()).Inc()
util.Event().Log("msg", "add to flush queue", "userID", userID, "reason", flush, "firstTime", firstTime, "fp", fp, "series", series.metric, "nlabels", len(series.metric), "queue", flushQueueIndex)
}
}
Expand Down Expand Up @@ -279,6 +278,8 @@ func (i *Ingester) flushUserSeries(flushQueueIndex int, userID string, fp model.
return nil
}

i.metrics.seriesFlushReasons.WithLabelValues(reason.String()).Inc()

// flush the chunks without locking the series, as we don't want to hold the series lock for the duration of the dynamo/s3 rpcs.
ctx, cancel := context.WithTimeout(context.Background(), i.cfg.FlushOpTimeout)
defer cancel() // releases resources if slowOperation completes before timeout elapses
Expand Down
8 changes: 4 additions & 4 deletions pkg/ingester/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type ingesterMetrics struct {
chunkSize prometheus.Histogram
chunkAge prometheus.Histogram
memoryChunks prometheus.Gauge
flushReasons *prometheus.CounterVec
seriesFlushReasons *prometheus.CounterVec
droppedChunks prometheus.Counter
oldestUnflushedChunkTimestamp prometheus.Gauge
}
Expand Down Expand Up @@ -187,9 +187,9 @@ func newIngesterMetrics(r prometheus.Registerer, createMetricsConflictingWithTSD
Name: "cortex_ingester_memory_chunks",
Help: "The total number of chunks in memory.",
}),
flushReasons: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
Name: "cortex_ingester_flush_reasons",
Help: "Total number of series scheduled for flushing, with reasons.",
seriesFlushReasons: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
Name: "cortex_ingester_series_flush_reasons",
Help: "Total number of flushed series, with reasons.",
}, []string{"reason"}),
droppedChunks: promauto.With(r).NewCounter(prometheus.CounterOpts{
Name: "cortex_ingester_dropped_chunks_total",
Expand Down