[ElasticsearchClient] Update Semantic Conventions#4635
Conversation
Update the Semantic Conventions to v1.42.0 when `OTEL_SEMCONV_STABILITY_OPT_IN=database` is enabled. Resolves open-telemetry#2302. Resolves open-telemetry#2976. Contributes to open-telemetry#4064.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4635 +/- ##
==========================================
+ Coverage 77.29% 77.55% +0.25%
==========================================
Files 466 466
Lines 19707 19568 -139
==========================================
- Hits 15233 15175 -58
+ Misses 4474 4393 -81
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Add PR number.
Only call `ToString()` for the method name once.
- Derive the `db.operation.name` attribute from the ElasticSearch operation. - Set the span's DisplayName. - Refactor tests.
There was a problem hiding this comment.
Pull request overview
Updates the ElasticsearchClient instrumentation to support the newer database semantic conventions (v1.42.0) behind OTEL_SEMCONV_STABILITY_OPT_IN=database (or database/dup), including emitting the corresponding new attributes and using schema URLs via ActivitySourceFactory.
Changes:
- Added opt-in logic (via
OTEL_SEMCONV_STABILITY_OPT_IN) to emit old, new, or both sets of database-related attributes. - Updated span naming/tagging to align with the newer conventions (e.g.,
db.operation.name,db.system.name,server.address,db.response.status_code,error.type). - Added/expanded unit tests to validate the new/dual emission behaviors and opt-in parsing.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/ElasticsearchClientTests.cs | Adds coverage for new/dual semantic convention emission and span naming. |
| test/OpenTelemetry.Instrumentation.ElasticsearchClient.Tests/ElasticsearchClientInstrumentationOptionsTests.cs | Verifies environment-variable opt-in parsing for old/new/dup behavior. |
| src/OpenTelemetry.Instrumentation.ElasticsearchClient/README.md | Updates semantic convention reference links to v1.42.0 anchors. |
| src/OpenTelemetry.Instrumentation.ElasticsearchClient/OpenTelemetry.Instrumentation.ElasticsearchClient.csproj | Links additional shared helpers required for schema URL and semantic convention opt-in support. |
| src/OpenTelemetry.Instrumentation.ElasticsearchClient/Implementation/ElasticsearchRequestPipelineDiagnosticListener.cs | Implements new attribute emission, schema URL selection, db.operation.name derivation, and new span naming rules. |
| src/OpenTelemetry.Instrumentation.ElasticsearchClient/ElasticsearchClientInstrumentationOptions.cs | Adds opt-in initialization (env var) and internal flags controlling old/new attribute emission. |
| src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md | Documents the new semantic convention opt-in behavior and attribute mapping changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Bump version to v1.43.0.
Move entry after merge with main.
Changes
Update the Semantic Conventions to v1.43.0 when
OTEL_SEMCONV_STABILITY_OPT_IN=database(ordatabase/dup) is enabled.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)