influxdb-2.4: capture db.operation.batch.size for BatchPoints writes#19279
influxdb-2.4: capture db.operation.batch.size for BatchPoints writes#19279bhuvan-somisetty wants to merge 2 commits into
Conversation
A write through InfluxDB.write(BatchPoints) sends a whole batch of points in a single request, but the point count was never recorded on the span. Read BatchPoints.getPoints().size() in the write advice and expose it via InfluxDbAttributesGetter#getDbOperationBatchSize, the same pattern already used by the hbase-client instrumentation.
Pull request dashboard statusStatus last refreshed: 2026-07-21 03:17:02 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, report it with the result you expected. |
There was a problem hiding this comment.
Pull request overview
Adds stable semantic-convention batch-size telemetry for InfluxDB BatchPoints writes.
Changes:
- Captures the number of points in batch writes.
- Exposes it through
InfluxDbAttributesGetter. - Verifies stable-semconv emission in the existing integration test.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
InfluxDbOperation.java |
Stores the nullable batch size. |
InfluxDbImplInstrumentation.java |
Extracts the BatchPoints point count. |
InfluxDbAttributesGetter.java |
Supplies the batch size to database attribute extraction. |
InfluxDbClientTest.java |
Asserts db.operation.batch.size = 2. |
|
All checks are green now. @trask @laurit @jaydeluca @zeitlinger would any of you have some time to take a look? You've reviewed my last few PRs (#19154, #19088, #19078) so tagging you again, but happy to hear from anyone else too. |
|
hi @bhuvan-somisetty! I'm not sure that this should be represented a batch operation, which is related to why I sent open-telemetry/semantic-conventions#3811, what do you think? thanks |
… writes" This reverts commit 78ef988.
|
@trask Good point, and that clarification in semantic-conventions#3811 makes it clear: a I've reverted the |
Resolves #19264
Description
influxdb-2.4recordsdb.operation.namefor writes, but a write throughInfluxDB.write(BatchPoints)sends a whole batch of points in a single request and the point count was never captured. This meant a batch write of, say, 500 points looked identical on the span to a write of a single point.db.operation.batch.sizeis a stable database semantic-convention attribute, and the point count is readily available on theBatchPointsobject the instrumentation already has in hand (BatchPoints.getPoints()). This follows the same pattern already used by thehbase-clientinstrumentation for its batch operations.Changes
batchSizefield toInfluxDbOperation(the@AutoValuerequest object).InfluxDbImplInstrumentation.InfluxDbModifyAdvice#onEnter, whenarg0 instanceof BatchPoints, read((BatchPoints) arg0).getPoints().size()and pass it intoInfluxDbOperation.create(...). It staysnullfor the UDP /createDatabase/deleteDatabasepaths, where there is no batch.getDbOperationBatchSizeinInfluxDbAttributesGetterto return that value.InfluxDbClientTest#testQueryAndModifyWithOneArgumentto assertdb.operation.batch.size = 2on the write span for the existing two-pointBatchPointswrite.No new configuration is needed. The shared
DbClientAttributesExtractoralready emitsdb.operation.batch.sizeunder stable semconv and treats a size of1as a non-batch operation, so single-point writes are unaffected.Test plan
./gradlew :instrumentation:influxdb-2.4:javaagent:compileJava :instrumentation:influxdb-2.4:javaagent:compileTestJava./gradlew :instrumentation:influxdb-2.4:javaagent:spotlessCheck :instrumentation:influxdb-2.4:javaagent:checkstyleMain :instrumentation:influxdb-2.4:javaagent:checkstyleTest./gradlew :instrumentation:influxdb-2.4:javaagent:test(requires Docker/testcontainers, run in CI)