Skip to content

minor: Emit taskStatus on task/run/time from the statsd and prometheus emitters - #20122

Open
amaechler wants to merge 1 commit into
apache:masterfrom
amaechler:task-run-time-taskstatus
Open

minor: Emit taskStatus on task/run/time from the statsd and prometheus emitters#20122
amaechler wants to merge 1 commit into
apache:masterfrom
amaechler:task-run-time-taskstatus

Conversation

@amaechler

@amaechler amaechler commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds taskStatus to task/run/time in the Prometheus emitter, which will allow to easily group run times by success status (and alert on outliers).

taskStatus takes at most two values here (SUCCESS, FAILED), so this at most doubles the cardinality.

Release note

The statsd and prometheus emitters now emit the taskStatus dimension on task/run/time This makes it possible to count task successes and failures per task type through these emitters.

This is a breaking change for existing dashboards and alerts on task/run/time:

  • statsd (non-dogstatsd): dimension values are joined into the dotted metric name, so druid.overlord.task.run.time.<dataSource>.<taskType> becomes druid.overlord.task.run.time.<dataSource>.<taskStatus>.<taskType>. Queries against the old name stop receiving data.
  • statsd (dogstatsd): a taskStatus tag is added; existing queries keep working, aggregating over it.
  • prometheus: a taskStatus label is added. Queries selecting on an exact label set, and recording rules assuming the old set, need updating.

Operators wanting the previous behaviour can pin the old dimension list with druid.emitter.statsd.dimensionMapPath or druid.emitter.prometheus.dimensionMapPath.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

task/run/time is emitted on every task completion with a taskStatus dimension
of SUCCESS or FAILED, set by IndexTaskUtils.setTaskStatusDimensions from both
call sites (TaskQueue.emitTaskCompletionLogsAndMetrics and UnusedSegmentsKiller).
docs/operations/metrics.md documents it. Both emitters filter user dimensions
through a per-metric allow-list, and neither listed taskStatus, so the dimension
was dropped on the way out and the metric could not distinguish a successful task
from a failed one.

This is the dimension that makes "count task/run/time grouped by taskType and
taskStatus" work, which is the usual recommendation for alerting on failures of
one task type while ignoring another.

taskId, groupId and description are documented on this metric too and stay
filtered out: the first two are unbounded and description is a truncated error
message.

PrometheusEmitterTest.testEmitterMetric asserted the exact label set for this
metric and is updated for the added label.
@amaechler amaechler changed the title Emit taskStatus on task/run/time from the statsd and prometheus emitters minor: Emit taskStatus on task/run/time from the statsd and prometheus emitters Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant