Skip to content

metrics: document the OpenSearch gauge semantics in HELP text - #1123

Closed
unseenmagik wants to merge 1 commit into
komoot:masterfrom
unseenmagik:metrics-gauge-descriptions
Closed

unseenmagik wants to merge 1 commit into
komoot:masterfrom
unseenmagik:metrics-gauge-descriptions

Conversation

@unseenmagik

Copy link
Copy Markdown

The OpenSearch gauges in OpenSearchMetrics are registered without a description, so /metrics exposes no # HELP line for any of them.

This matters most for opensearch_cluster_health_status, which encodes 2 = green, 1 = yellow, 0 = red — the inverse of the elasticsearch_exporter convention, where a higher value means worse health. A healthy cluster reports a constant 2 indefinitely, so a scrape is indistinguishable from a gauge stuck at a bad value, and nothing in the exposition states the scale. This has already produced a false "permanently RED cluster" report downstream (rtuszik/photon-docker#374).

Changes:

  • .description(...) on all ten OpenSearch gauges
  • a regression test asserting the health status encoding appears in the HELP text

The numeric mapping itself is unchanged — flipping it would break dashboards that already read it correctly.

Verified with ./gradlew test --tests de.komoot.photon.api.ApiMetricsTest (4/4 pass). Reverting just the health gauge description fails the new test and leaves the other three passing, confirming it pins the HELP text rather than passing incidentally.

🤖 Generated with Claude Code

The gauges are registered without a description, so /metrics exposes no
HELP line for any of them. This matters most for
opensearch_cluster_health_status, whose encoding (2 = green, 1 = yellow,
0 = red) is the inverse of the elasticsearch_exporter convention where a
higher value means worse health.

Because a healthy cluster reports a constant 2 forever, a scrape is
indistinguishable from a gauge stuck at a bad value, and the scale is
documented nowhere in the exposition. Add descriptions to all OpenSearch
gauges and a regression test pinning the health status encoding in the
HELP text.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@lonvia lonvia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all Claude comments in the code. They add no value.

@lonvia

lonvia commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

@henrik242 Do you mind checking if that looks okay for you?

And should we switch the health status meanings to align with elasticsearch-exporter to avoid further confusion?

@lonvia

lonvia commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

I'm closing this as per our AI contribution policy. Claude-generated PRs need to have a human behind them that takes responsibility for the code.

@lonvia lonvia closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants