Skip to content

Emit missing ingest/merge/time, ingest/merge/cpu and ingest/persists/cpu metrics#18866

Merged
abhishekrb19 merged 6 commits into
apache:masterfrom
abhishekrb19:missing_appendator_metrics
Dec 26, 2025
Merged

Emit missing ingest/merge/time, ingest/merge/cpu and ingest/persists/cpu metrics#18866
abhishekrb19 merged 6 commits into
apache:masterfrom
abhishekrb19:missing_appendator_metrics

Conversation

@abhishekrb19

@abhishekrb19 abhishekrb19 commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

The metrics ingest/merge/time, ingest/merge/cpu and ingest/persists/cpu metrics have been documented but were previously reported as zero because they were not set in the streaming and batch appendators (it probably regressed in a refactor).

These metrics are now set by the appendators and will be reported during the persist and merge phases for realtime and batch ingestion. Updated unit tests to verify that these values are emitted (non-zero values).

Also, cleaned up KafkaIndexTaskTest and KinesisIndexTaskTest by initializing a StubServiceEmitter as a non-static member in the base class SeekableStreamIndexTaskTestBase so it can be used by each unit test as needed.

Release note

Correctly report ingest/merge/time, ingest/merge/cpu and ingest/persists/cpu metrics for streaming and batch ingestion tasks, which were previously always misreported as zero values.

This PR has:

- Adds the missing streaming appendator metrics
for ingest/merge/time, ingest/merge/cpu and ingest/persists/cpu
Init ServiceEmitter as non-static to reuse individually for
each test

Add a helper in the base class for asserting segment generation metrics
@abhishekrb19 abhishekrb19 changed the title Emit missing ingest/merge/time, ingest/merge/cpu and ingest/persists/cpu metrics for streaming tasks Emit missing ingest/merge/time, ingest/merge/cpu and ingest/persists/cpu metrics Dec 23, 2025

@jtuglu1 jtuglu1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM – left minor comments.

@@ -748,14 +750,15 @@ public Object call() throws IOException
}
finally {
metrics.incrementNumPersists();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: can we move the increments below the time-sensitive metric emissions? Given we are reporting at nano-scale, chance of interrupt and/or delay due to atomic load+store can skew the nano count by X-XXns.

identifier,
segment.getSize(),
indexes.size(),
(mergeFinishTime - startTime) / 1000000,

@jtuglu1 jtuglu1 Dec 23, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 We should probably make sure this is not being done elsewhere. For future readers, System.nanoTime() is actually more expensive than System.getCurrentTimeMillis() so if you need milli-level precision, just use the latter from the start. Milli itself is also expensive: https://pzemtsov.github.io/2017/07/23/the-slow-currenttimemillis.html

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, there are a few other places where this nanos -> millis conversion happens, even though only millis is really required. We can clean those up together in a separate change.

@abhishekrb19
abhishekrb19 merged commit 47d6f34 into apache:master Dec 26, 2025
97 of 100 checks passed
@abhishekrb19
abhishekrb19 deleted the missing_appendator_metrics branch December 26, 2025 17:22
@kgyrtkirk kgyrtkirk added this to the 36.0.0 milestone Jan 19, 2026
airlock-confluentinc Bot pushed a commit to confluentinc/druid that referenced this pull request Jun 7, 2026
…eb-console snapshots, stabilize BatchAppenderator timing assertion

Four jobs failed on the 37.0.0-confluent PR build. All four are fork/upstream
mismatches, not Confluent feature regressions:

- "Other Tests" and "Druid E2E Tests" died instantly with
  "Could not find the selected project in the reactor". The .semaphore config
  was carried from druid-34 and still referenced integration-tests,
  integration-tests-ex/cases, integration-tests-ex/image and
  integration-tests-ex/tools, which upstream-37 removed (replaced by
  embedded-tests). Point E2E at quidem-ut,embedded-tests and drop the deleted
  modules from the Other Tests exclusion list.

- "Web Console" failed 16 Jest snapshot tests. The squashed #378 patch carried
  druid-34-era web-console .snap files, overwriting druid-37's snapshots and
  stripping the Blueprint default props that druid-37's @blueprintjs renders
  (e.g. 210 lines from timezone-menu-items). Restore all affected .snap files
  to druid-37.0.0. console-config.js (defaultQueryContext) is left as the
  intentional Confluent runtime config.

- "Server" failed on BatchAppenderatorTest mergeTimeMillis() > 0 (new in
  upstream-37 via apache#18866). On fast CI agents the sub-millisecond in-memory
  merge rounds to 0. Relax the wall-clock millisecond assertions to >= 0 while
  keeping the CPU-time (nanosecond) assertions strict, preserving the intent.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.

3 participants