Skip to content

Commit

Permalink
Allow ignoring out of order exemplars (#9151)
Browse files Browse the repository at this point in the history
* Allow ignoring out of order exemplars

Signed-off-by: György Krajcsovits <[email protected]>

* Update pkg/ingester/ingester.go

Co-authored-by: Peter Štibraný <[email protected]>

---------

Signed-off-by: György Krajcsovits <[email protected]>
Co-authored-by: Peter Štibraný <[email protected]>
  • Loading branch information
krajorama and pstibrany authored Sep 2, 2024
1 parent b58a08b commit c715b0a
Show file tree
Hide file tree
Showing 7 changed files with 435 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* [FEATURE] Querier: added support for `limitk()` and `limit_ratio()` experimental PromQL functions. Experimental functions are disabled by default, but can be enabled setting `-querier.promql-experimental-functions-enabled=true` in the query-frontend and querier. #8632
* [FEATURE] Querier: experimental support for `X-Mimir-Chunk-Info-Logger` header that triggers logging information about TSDB chunks loaded from ingesters and store-gateways in the querier. The header should contain the comma separated list of labels for which their value will be included in the logs. #8599
* [FEATURE] Ruler: added experimental configuration, `-ruler.rule-evaluation-write-enabled`, to disable writing the result of rule evaluation to ingesters. This feature can be used for testing purposes. #9060
* [FEATURE] Ingester: added experimental configuration `ingester.ignore-ooo-exemplars`. When set to `true` out of order exemplars are no longer reported to the remote write client. #9151
* [ENHANCEMENT] Compactor: Add `cortex_compactor_compaction_job_duration_seconds` and `cortex_compactor_compaction_job_blocks` histogram metrics to track duration of individual compaction jobs and number of blocks per job. #8371
* [ENHANCEMENT] Rules: Added per namespace max rules per rule group limit. The maximum number of rules per rule groups for all namespaces continues to be configured by `-ruler.max-rules-per-rule-group`, but now, this can be superseded by the new `-ruler.max-rules-per-rule-group-by-namespace` option on a per namespace basis. This new limit can be overridden using the overrides mechanism to be applied per-tenant. #8378
* [ENHANCEMENT] Rules: Added per namespace max rule groups per tenant limit. The maximum number of rule groups per rule tenant for all namespaces continues to be configured by `-ruler.max-rule-groups-per-tenant`, but now, this can be superseded by the new `-ruler.max-rule-groups-per-tenant-by-namespace` option on a per namespace basis. This new limit can be overridden using the overrides mechanism to be applied per-tenant. #8425
Expand Down
11 changes: 11 additions & 0 deletions cmd/mimir/config-descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -3973,6 +3973,17 @@
"fieldType": "int",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "ignore_ooo_exemplars",
"required": false,
"desc": "Whether to ignore exemplars with out-of-order timestamps. If enabled, exemplars with out-of-order timestamps are silently dropped, otherwise they cause partial errors.",
"fieldValue": null,
"fieldDefaultValue": false,
"fieldFlag": "ingester.ignore-ooo-exemplars",
"fieldType": "boolean",
"fieldCategory": "experimental"
},
{
"kind": "field",
"name": "native_histograms_ingestion_enabled",
Expand Down
2 changes: 2 additions & 0 deletions cmd/mimir/help-all.txt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,8 @@ Usage of ./cmd/mimir/mimir:
Override the expected name on the server certificate.
-ingester.error-sample-rate int
Each error will be logged once in this many times. Use 0 to log all of them. (default 10)
-ingester.ignore-ooo-exemplars
[experimental] Whether to ignore exemplars with out-of-order timestamps. If enabled, exemplars with out-of-order timestamps are silently dropped, otherwise they cause partial errors.
-ingester.ignore-series-limit-for-metric-names string
Comma-separated list of metric names, for which the -ingester.max-global-series-per-metric limit will be ignored. Does not affect the -ingester.max-global-series-per-user limit.
-ingester.instance-limits.max-inflight-push-requests int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3280,6 +3280,12 @@ The `limits` block configures default and per-tenant limits imposed by component
# CLI flag: -ingester.max-global-exemplars-per-user
[max_global_exemplars_per_user: <int> | default = 0]
# (experimental) Whether to ignore exemplars with out-of-order timestamps. If
# enabled, exemplars with out-of-order timestamps are silently dropped,
# otherwise they cause partial errors.
# CLI flag: -ingester.ignore-ooo-exemplars
[ignore_ooo_exemplars: <boolean> | default = false]
# (experimental) Enable ingestion of native histogram samples. If false, native
# histogram samples are ignored without an error. To query native histograms
# with query-sharding enabled make sure to set
Expand Down
13 changes: 8 additions & 5 deletions pkg/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,8 @@ func (i *Ingester) pushSamplesToAppender(userID string, timeseries []mimirpb.Pre
// and failed ingested exemplars is equal to the total number of processed ones.
stats.failedExemplarsCount++

if errors.Is(err, storage.ErrOutOfOrderExemplar) {
isOOOExemplar := errors.Is(err, storage.ErrOutOfOrderExemplar)
if isOOOExemplar {
outOfOrderExemplars++
// Only report out of order exemplars if all are out of order, otherwise this was a partial update
// to some existing set of exemplars.
Expand All @@ -1597,10 +1598,12 @@ func (i *Ingester) pushSamplesToAppender(userID string, timeseries []mimirpb.Pre
}
}

// Error adding exemplar
updateFirstPartial(nil, func() softError {
return newTSDBIngestExemplarErr(err, model.Time(ex.TimestampMs), ts.Labels, ex.Labels)
})
// Error adding exemplar. Do not report to client if the error was out of order and we ignore such error.
if !isOOOExemplar || !i.limits.IgnoreOOOExemplars(userID) {
updateFirstPartial(nil, func() softError {
return newTSDBIngestExemplarErr(err, model.Time(ex.TimestampMs), ts.Labels, ex.Labels)
})
}
}
}
}
Expand Down
Loading

0 comments on commit c715b0a

Please sign in to comment.