Skip to content

minor: Add segment/allocated/count metric#19674

Open
kfaraz wants to merge 3 commits into
apache:masterfrom
kfaraz:metric_for_allocation
Open

minor: Add segment/allocated/count metric#19674
kfaraz wants to merge 3 commits into
apache:masterfrom
kfaraz:metric_for_allocation

Conversation

@kfaraz

@kfaraz kfaraz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Related to #19651 which adds metrics for upgrade of pending segments.

Changes

  • Add metric segment/allocated/count to track IDs of allocated pending segments
  • Modify concurrent append test to assert that
    • pending segments are always allocated at the latest version only
    • pending segments are upgraded when doing a concurrent replace

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.

@FrankChen021 FrankChen021 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Severity Findings
P0 0
P1 2
P2 0
P3 1
Total 3
Severity Findings
P0 0
P1 2
P2 0
P3 1
Total 3

Reviewed 3 of 3 changed files.


This is an automated review by Codex GPT-5.6-Sol

identifier = tryAllocateSubsequentSegment(toolbox, task, rowInterval, usedSegmentsForRow.iterator().next());
}
if (identifier != null) {
emitSuccessMetric(identifier, task, toolbox);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P1] Emit the metric for batched allocations

LocalTaskActionClient selects performAsync whenever batching is enabled, and TaskLockConfig enables batching by default. That path completes directly through SegmentAllocationQueue, so this new call in perform is bypassed and the metric is absent under the default configuration.

{
final ServiceMetricEvent.Builder metricBuilder = new ServiceMetricEvent.Builder();
IndexTaskUtils.setTaskDimensions(metricBuilder, task);
if (task instanceof SeekableStreamIndexTask<?,?,?>) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P1] Fix the new checkstyle violations

SeekableStreamIndexTask<?,?,?> violates the configured WhitespaceAfter check, while changing line 309 to .toList() leaves java.util.stream.Collectors unused and violates UnusedImports; validation will fail until both are corrected.

Comment thread docs/operations/metrics.md Outdated
|`segment/added/bytes`|Size in bytes of new segments created.| `dataSource`, `taskId`, `taskType`, `groupId`, `interval`, `tags`|Varies|
|`segment/moved/bytes`|Size in bytes of segments moved/archived via the Move Task.| `dataSource`, `taskId`, `taskType`, `groupId`, `interval`, `tags`|Varies|
|`segment/nuked/bytes`|Size in bytes of segments deleted via the Kill Task.| `dataSource`, `taskId`, `taskType`, `groupId`, `interval`, `tags`|Varies|
|`segment/allocated/count`|Number of segments successfully allocated by the Overlord to an append (realtime or batch) task. May be emitted multiple times for a single allocated segment ID if multiple tasks request an allocation with the same parameters.|`id`, `dataSource`, `taskId`, `taskType`, `groupId`, tags`|Always 1|

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P3] Document the emitted supervisor dimension

The implementation adds supervisorId for seekable-stream tasks, but this dimension is omitted from the metric table. The same row also has an unmatched backtick around tags.

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.

2 participants