Emit datadog metric when Elasticsearch index is set to read only/allow delete - #27
Open
gherceg wants to merge 1 commit into
Open
Emit datadog metric when Elasticsearch index is set to read only/allow delete#27gherceg wants to merge 1 commit into
gherceg wants to merge 1 commit into
Conversation
gherceg
marked this pull request as ready for review
July 20, 2026 01:05
Emits elasticsearch.index.read_only_allow_delete=1 per index that has the index.blocks.read_only_allow_delete block set, which Elasticsearch applies when disk usage crosses the flood-stage watermark. The block must be cleared manually, so this surfaces indices stuck rejecting writes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gherceg
force-pushed
the
gh/es-readonly-check
branch
from
July 20, 2026 01:09
35d8b9f to
9f8334c
Compare
millerdev
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When Elasticsearch disk usage reaches the flood-stage watermark (currently set to 95%), ES sets
index.blocks.read_only_allow_delete: trueon affected indices. This block is not cleared automatically when disk frees up. It must be reset manually, and until then the index rejects writes. We currently have no good signal for this other than pillow errors which are not monitored closely.Solution
A new
elasticsearch_customcheck (modeled oncouchdb_custom, PR #25) that queries index settings and emits a per-index gaugeelasticsearch.index.read_only_allow_delete = 1, taggedindex:<name>, for each index that is blocked.Nothing is emitted for healthy indices. I figured this would help keep the custom metric count lower since we only care about this signal when it's "on".
Testing
Plan to test manually on staging which will require a related commcare-cloud PR to get the elasticsearch_custom integration onto one of the elasticsearch machines.