Skip to content
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

Ingest-storage alerts #7702

Merged
merged 19 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@

* [ENHANCEMENT] Alerts: allow configuring alerts range interval via `_config.base_alerts_range_interval_minutes`. #7591
* [ENHANCEMENT] Dashboards: Add panels for monitoring distributor and ingester when using ingest-storage. These panels are disabled by default, but can be enabled using `show_ingest_storage_panels: true` config option. Similarly existing panels used when distributors and ingesters use gRPC for forwarding requests can be disabled by setting `show_grpc_ingestion_panels: false`. #7670 #7699
* [ENHANCEMENT] Alerts: add the following alerts when using ingest-storage: #7699
* [ENHANCEMENT] Alerts: add the following alerts when using ingest-storage: #7699 #7702
* `MimirIngesterLastConsumedOffsetCommitFailed`
* [BUGFIX] Dashobards: Fix regular expression for matching read-path gRPC ingester methods to include querying of exemplars, label-related queries, or active series queries. #7676
* `MimirIngesterFailedToReadRecordsFromKafka`
* `MimirIngesterKafkaFetchErrorsRateTooHigh`
* `MimirStartingIngesterKafkaReceiveDelayIncreasing`
* `MimirRunningIngesterReceiveDelayTooHigh`
* `MimirIngesterFailsToProcessRecordsFromKafka`
* `MimirIngesterFailsEnforceStrongConsistencyOnReadPath`
* [BUGFIX] Dashboards: Fix regular expression for matching read-path gRPC ingester methods to include querying of exemplars, label-related queries, or active series queries. #7676

### Jsonnet

Expand Down
98 changes: 97 additions & 1 deletion docs/sources/mimir/manage/mimir-runbooks/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ How to **investigate**:

- Check the `Mimir / Writes` dashboard
- Looking at the dashboard you should see in which Mimir service the high latency originates
- The panels in the dashboard are vertically sorted by the network path (eg. gateway -> distributor -> ingester)
- The panels in the dashboard are vertically sorted by the network path (eg. gateway -> distributor -> ingester). When using [ingest-storage](#mimir-ingest-storage-experimental), network path changes to gateway -> distributor -> Kafka instead.
- Deduce where in the stack the latency is being introduced
- **`gateway`**
- Latency may be caused by the time taken for the gateway to receive the entire request from the client. There are a multitude of reasons this can occur, so communication with the user may be necessary. For example:
Expand All @@ -201,6 +201,7 @@ How to **investigate**:
- There could be a problem with authentication (eg. slow to run auth layer)
- **`distributor`**
- Typically, distributor p99 latency is in the range 50-100ms. If the distributor latency is higher than this, you may need to scale up the distributors.
- When using Mimir [ingest-storage](#mimir-ingest-storage-experimental), distributors are writing requests to Kafka-compatible backend. Increased latency in distributor may also come from this backend.
- **`ingester`**
- Typically, ingester p99 latency is in the range 5-50ms. If the ingester latency is higher than this, you should investigate the root cause before scaling up ingesters.
- Check out the following alerts and fix them if firing:
Expand Down Expand Up @@ -243,6 +244,9 @@ How to **investigate**:
- If queries are not waiting in queue
- Consider [enabling query sharding]({{< relref "../../references/architecture/query-sharding#how-to-enable-query-sharding" >}}) if not already enabled, to increase query parallelism
- If query sharding already enabled, consider increasing total number of query shards (`query_sharding_total_shards`) for tenants submitting slow queries, so their queries can be further parallelized
- **`ingester`**
- Check if ingesters are not overloaded. If they are and you can scale up ingesters vertically, that may be the best action. If that's not possible, scaling horizontally can help as well, but it can take several hours for ingesters to fully redistribute their series.
- When using [ingest-storage](#mimir-ingest-storage-experimental), check ratio of queries using strong-consistency, and latency of queries using strong-consistency.

#### Alertmanager

Expand Down Expand Up @@ -278,6 +282,7 @@ How to **investigate**:
- If the failing service is crashing / panicking: look for the stack trace in the logs and investigate from there
- If crashing service is query-frontend, querier or store-gateway, and you have "activity tracker" feature enabled, look for `found unfinished activities from previous run` message and subsequent `activity` messages in the log file to see which queries caused the crash.
- When using Memberlist as KV store for hash rings, ensure that Memberlist is working correctly. See instructions for the [`MimirGossipMembersTooHigh`](#MimirGossipMembersTooHigh) and [`MimirGossipMembersTooLow`](#MimirGossipMembersTooLow) alerts.
- When using [ingest-storage](#mimir-ingest-storage-experimental) and distributors are failing to write requests to Kafka, make sure that Kafka is up and running correctly.

#### Alertmanager

Expand Down Expand Up @@ -1327,6 +1332,97 @@ How to **investigate**:
- Check ingester logs to find details about the error.
- Check Kafka logs and health.

### MimirIngesterFailedToReadRecordsFromKafka

This alert fires when an ingester is failing to read records from Kafka backend.

How it **works**:

- Ingester connects to Kafka brokers and reads records from it. Records contain write requests committed by distributors.
- When ingester fails to read more records from Kafka due to error, ingester logs such error.
- This can be normal if Kafka brokers are restarting, however if read errors continue for some time, alert is raised.

How to **investigate**:

- Check ingester logs to find details about the error.
- Check Kafka logs and health.

### MimirIngesterKafkaFetchErrorsRateTooHigh

This alert fires when an ingester is receiving errors instead of "fetches" from Kafka.

How it **works**:

- Ingester uses Kafka client to read records (containing write requests) from Kafka.
- Kafka client can return errors instead of more records.
- If rate of returned errors compared to returned records is too high, alert is raised.
- Kafka client can return errors [documented in the source code](https://github.com/grafana/mimir/blob/24591ae56cd7d6ef24a7cc1541a41405676773f4/vendor/github.com/twmb/franz-go/pkg/kgo/record_and_fetch.go#L332-L366).

How to **investigate**:

- Check ingester logs to find details about the error.
- Check Kafka logs and health.

### MimirStartingIngesterKafkaReceiveDelayIncreasing

This alert fires when "receive delay" reported by ingester during "starting" phase is not decreasing.

How it **works**:

- When ingester is starting, it needs to fetch and process records from Kafka until preconfigured consumption lag is honored. The maximum tolerated lag before an ingester is considered to have caught up reading from a partition at startup can be configured via `-ingest-storage.kafka.max-consumer-lag-at-startup`.
- Each record has a timestamp when it was sent to Kafka by the distributor. When ingester reads the record, it computes "receive delay" as a difference between current time (when record was read) and time when record was sent to Kafka. This receive delay is reported in the metric `cortex_ingest_storage_reader_receive_delay_seconds`. You can see receive delay on `Mimir / Writes` dashboard, in section "Ingester (ingest storage – end-to-end latency)".
- Under normal conditions when ingester is processing records faster than records are appearing, receive delay should be decreasing, until `-ingest-storage.kafka.max-consumer-lag-at-startup` is honored.
- When ingester is starting, and observed "receive delay" is increasing, alert is raised.

How to **investigate**:

- Check if ingester is fast enough to process all data in Kafka.

### MimirRunningIngesterReceiveDelayTooHigh

This alert fires when "receive delay" reported by ingester while it's running reaches alert threshold.

How it **works**:

- After ingester start and catches up with records in Kafka, ingester switches to "running" mode.
- In running mode, ingester continues to process incoming records from Kafka and continues to report "receive delay". See [`MimirStartingIngesterKafkaReceiveDelayIncreasing`](#MimirStartingIngesterKafkaReceiveDelayIncreasing) runbook for details about this metric.
- Under normal conditions when ingester is running and it is processing records faster than records are appearing, receive delay should be stable and low.
- If observed "receive delay" increases and reaches certain threshold, alert is raised.

How to **investigate**:

- Check if ingester is fast enough to process all data in Kafka.
- If ingesters are too slow, consider scaling ingesters horizontally to spread incoming series between more ingesters.

### MimirIngesterFailsToProcessRecordsFromKafka

This alert fires when ingester is unable to process incoming records from Kafka due to internal errors. If ingest-storage wasn't used, such push requests would end up with 5xx errors.

How it **works**:

- Ingester reads records from Kafka, and processes them locally. Processing means unmarshalling the data and handling write requests stored in records.
- Write requests can fail due to "client" or "server" errors. An example of client error is too low limit for number of series. Server error can be for example ingester hitting an instance limit.
- If requests keep failing due to server errors, this alert is raised.

How to **investigate**:

- Check ingester logs to see why requests are failing, and troubleshoot based on that.

### MimirIngesterFailsEnforceStrongConsistencyOnReadPath

This alert fires when too many read-requests with strong consistency are failing.

How it **works**:

- When read request asks for strong-consistency guarantee, ingester will read the last produced offset from Kafka, and wait until record with this offset is consumed.
- If read request times out during this wait, that is considered to be a failure of request with strong-consistency.
- If requests keep failing due to failure to enforce strong-consistency, this alert is raised.

How to **investigate**:

- Check wait latency of requests with strong-consistency on `Mimir / Queries` dashboard.
- Check if ingester needs to process too many records, and whether ingesters need to be scaled up (vertically or horizontally).

## Errors catalog

Mimir has some codified error IDs that you might see in HTTP responses or logs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,80 @@ spec:
for: 15m
labels:
severity: critical
- alert: MimirIngesterFailedToReadRecordsFromKafka
annotations:
message: Mimir {{ $labels.pod }} in {{ $labels.cluster }}/{{ $labels.namespace
}} is failing to read records from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterfailedtoreadrecordsfromkafka
expr: |
sum by(cluster, namespace, pod, node_id) (rate(cortex_ingest_storage_reader_read_errors_total[1m]))
> 0
for: 5m
labels:
severity: critical
- alert: MimirIngesterKafkaFetchErrorsRateTooHigh
annotations:
message: Mimir {{ $labels.pod }} in {{ $labels.cluster }}/{{ $labels.namespace
}} is receiving fetch errors when reading records from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterkafkafetcherrorsratetoohigh
expr: |
sum by (cluster, namespace, pod) (rate (cortex_ingest_storage_reader_fetch_errors_total[5m]))
/
sum by (cluster, namespace, pod) (rate (cortex_ingest_storage_reader_fetches_total[5m]))
> 0.1
for: 15m
labels:
severity: critical
- alert: MimirStartingIngesterKafkaReceiveDelayIncreasing
annotations:
message: Mimir {{ $labels.pod }} in {{ $labels.cluster }}/{{ $labels.namespace
}} in "starting" phase is not reducing consumption lag of write requests read
from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimirstartingingesterkafkareceivedelayincreasing
expr: |
deriv((
sum by (cluster, namespace, pod) (rate(cortex_ingest_storage_reader_receive_delay_seconds_sum{phase="starting"}[1m]))
/
sum by (cluster, namespace, pod) (rate(cortex_ingest_storage_reader_receive_delay_seconds_count{phase="starting"}[1m]))
)[5m:1m]) > 0
for: 5m
labels:
severity: warning
- alert: MimirRunningIngesterReceiveDelayTooHigh
annotations:
message: Mimir {{ $labels.pod }} in {{ $labels.cluster }}/{{ $labels.namespace
}} in "running" phase is too far behind in its consumption of write requests
from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimirrunningingesterreceivedelaytoohigh
expr: |
(
sum by (cluster, namespace, pod) (rate(cortex_ingest_storage_reader_receive_delay_seconds_sum{phase="running"}[1m]))
/
sum by (cluster, namespace, pod) (rate(cortex_ingest_storage_reader_receive_delay_seconds_count{phase="running"}[1m]))
) > (10 * 60)
for: 5m
labels:
severity: critical
- alert: MimirIngesterFailsToProcessRecordsFromKafka
annotations:
message: Mimir {{ $labels.pod }} in {{ $labels.cluster }}/{{ $labels.namespace
}} fails to consume write requests read from Kafka due to internal errors.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterfailstoprocessrecordsfromkafka
expr: |
sum by (cluster, namespace, pod) (rate(cortex_ingest_storage_reader_records_failed_total{cause="server"}[1m])) > 0
for: 5m
labels:
severity: critical
- alert: MimirIngesterFailsEnforceStrongConsistencyOnReadPath
annotations:
message: Mimir {{ $labels.pod }} in {{ $labels.cluster }}/{{ $labels.namespace
}} fails to enforce strong-consistency on read-path.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterfailsenforcestrongconsistencyonreadpath
expr: |
sum by (cluster, namespace, pod) (rate(cortex_ingest_storage_strong_consistency_failures_total[1m])) > 0
for: 5m
labels:
severity: critical
- name: mimir_continuous_test
rules:
- alert: MimirContinuousTestNotRunningOnWrites
Expand Down
74 changes: 74 additions & 0 deletions operations/mimir-mixin-compiled-baremetal/alerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,80 @@ groups:
for: 15m
labels:
severity: critical
- alert: MimirIngesterFailedToReadRecordsFromKafka
annotations:
message: Mimir {{ $labels.instance }} in {{ $labels.cluster }}/{{ $labels.namespace
}} is failing to read records from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterfailedtoreadrecordsfromkafka
expr: |
sum by(cluster, namespace, instance, node_id) (rate(cortex_ingest_storage_reader_read_errors_total[1m]))
> 0
for: 5m
labels:
severity: critical
- alert: MimirIngesterKafkaFetchErrorsRateTooHigh
annotations:
message: Mimir {{ $labels.instance }} in {{ $labels.cluster }}/{{ $labels.namespace
}} is receiving fetch errors when reading records from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterkafkafetcherrorsratetoohigh
expr: |
sum by (cluster, namespace, instance) (rate (cortex_ingest_storage_reader_fetch_errors_total[5m]))
/
sum by (cluster, namespace, instance) (rate (cortex_ingest_storage_reader_fetches_total[5m]))
> 0.1
for: 15m
labels:
severity: critical
- alert: MimirStartingIngesterKafkaReceiveDelayIncreasing
annotations:
message: Mimir {{ $labels.instance }} in {{ $labels.cluster }}/{{ $labels.namespace
}} in "starting" phase is not reducing consumption lag of write requests read
from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimirstartingingesterkafkareceivedelayincreasing
expr: |
deriv((
sum by (cluster, namespace, instance) (rate(cortex_ingest_storage_reader_receive_delay_seconds_sum{phase="starting"}[1m]))
/
sum by (cluster, namespace, instance) (rate(cortex_ingest_storage_reader_receive_delay_seconds_count{phase="starting"}[1m]))
)[5m:1m]) > 0
for: 5m
labels:
severity: warning
- alert: MimirRunningIngesterReceiveDelayTooHigh
annotations:
message: Mimir {{ $labels.instance }} in {{ $labels.cluster }}/{{ $labels.namespace
}} in "running" phase is too far behind in its consumption of write requests
from Kafka.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimirrunningingesterreceivedelaytoohigh
expr: |
(
sum by (cluster, namespace, instance) (rate(cortex_ingest_storage_reader_receive_delay_seconds_sum{phase="running"}[1m]))
/
sum by (cluster, namespace, instance) (rate(cortex_ingest_storage_reader_receive_delay_seconds_count{phase="running"}[1m]))
) > (10 * 60)
for: 5m
labels:
severity: critical
- alert: MimirIngesterFailsToProcessRecordsFromKafka
annotations:
message: Mimir {{ $labels.instance }} in {{ $labels.cluster }}/{{ $labels.namespace
}} fails to consume write requests read from Kafka due to internal errors.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterfailstoprocessrecordsfromkafka
expr: |
sum by (cluster, namespace, instance) (rate(cortex_ingest_storage_reader_records_failed_total{cause="server"}[1m])) > 0
for: 5m
labels:
severity: critical
- alert: MimirIngesterFailsEnforceStrongConsistencyOnReadPath
annotations:
message: Mimir {{ $labels.instance }} in {{ $labels.cluster }}/{{ $labels.namespace
}} fails to enforce strong-consistency on read-path.
runbook_url: https://grafana.com/docs/mimir/latest/operators-guide/mimir-runbooks/#mimiringesterfailsenforcestrongconsistencyonreadpath
expr: |
sum by (cluster, namespace, instance) (rate(cortex_ingest_storage_strong_consistency_failures_total[1m])) > 0
for: 5m
labels:
severity: critical
- name: mimir_continuous_test
rules:
- alert: MimirContinuousTestNotRunningOnWrites
Expand Down
Loading
Loading