Skip to content

feat: add -health flag for Docker healthchecks - #6608

Merged
oleg-kozlyuk-grafana merged 2 commits into
grafana:mainfrom
antonio-mazzini:feat/healthcheck-command
Mar 10, 2026
Merged

feat: add -health flag for Docker healthchecks#6608
oleg-kozlyuk-grafana merged 2 commits into
grafana:mainfrom
antonio-mazzini:feat/healthcheck-command

Conversation

@antonio-mazzini

Copy link
Copy Markdown
Contributor

What this PR does

Adds a -health CLI flag to the Tempo binary that checks the /ready endpoint, enabling native Docker HEALTHCHECK without requiring a shell, curl, or wget in the container.

This is important because Tempo uses gcr.io/distroless/static-debian12 as its base image, which has no shell or network tools.

Usage

HEALTHCHECK CMD ["/tempo", "-health"]

Custom URL:

tempo -health -health.url=http://localhost:3200/ready

How it works

  • The -health flag is checked before any config parsing, so it works without a config file
  • Makes an HTTP GET to http://localhost:3200/ready (default) with a 5s timeout
  • Returns exit code 0 (healthy) or 1 (unhealthy)
  • Includes unit tests for flag parsing, URL extraction, and health check behavior

Reference

Follows the same pattern adopted in Loki: grafana/loki#20590

Closes #6536

Add a -health CLI flag that checks Tempo's /ready endpoint without
requiring a config file or shell in the container. This enables
native Docker HEALTHCHECK using the Tempo binary itself, which is
important since the distroless base image has no shell or curl.

Usage: tempo -health [-health.url=http://localhost:3200/ready]

Follows the same pattern adopted in Loki (grafana/loki#20590).
@cla-assistant

cla-assistant Bot commented Mar 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Comment thread cmd/tempo/health.go Outdated
Comment thread cmd/tempo/health.go Outdated
Comment thread cmd/tempo/main.go Outdated
@antonio-mazzini

Copy link
Copy Markdown
Contributor Author

Good points, switched to the standard flag package — much cleaner. Also printing the response body now on errors.

@oleg-kozlyuk-grafana

Copy link
Copy Markdown
Contributor

LGTM, let's get one more pair of eyes on this and merge if no corrections

@oleg-kozlyuk-grafana

Copy link
Copy Markdown
Contributor

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6012dd34db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/tempo/main.go
@oleg-kozlyuk-grafana
oleg-kozlyuk-grafana merged commit 0b1c067 into grafana:main Mar 10, 2026
24 checks passed
@oleg-kozlyuk-grafana

Copy link
Copy Markdown
Contributor

Thanks for your contribution @antonio-mazzini!

mattdurham pushed a commit to mattdurham/tempo that referenced this pull request Jun 18, 2026
* feat: add -health flag for Docker healthchecks

Add a -health CLI flag that checks Tempo's /ready endpoint without
requiring a shell in the container. This enables
native Docker HEALTHCHECK using the Tempo binary itself, which is
important since the distroless base image has no shell or curl.

Usage: tempo -health [-health.url=http://localhost:3200/ready]

Follows the same pattern adopted in Loki (grafana/loki#20590).

* refactor: use standard flag package for health check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants