Skip to content

[ElasticsearchClient] Update Semantic Conventions#4635

Open
martincostello wants to merge 8 commits into
open-telemetry:mainfrom
martincostello:gh-2302
Open

[ElasticsearchClient] Update Semantic Conventions#4635
martincostello wants to merge 8 commits into
open-telemetry:mainfrom
martincostello:gh-2302

Conversation

@martincostello

@martincostello martincostello commented Jul 2, 2026

Copy link
Copy Markdown
Member

Changes

Update the Semantic Conventions to v1.43.0 when OTEL_SEMCONV_STABILITY_OPT_IN=database (or database/dup) is enabled.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

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.
@github-actions github-actions Bot added the comp:instrumentation.elasticsearchclient Things related to OpenTelemetry.Instrumentation.ElasticsearchClient label Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.12977% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.55%. Comparing base (820d955) to head (1caa3b6).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../ElasticsearchRequestPipelineDiagnosticListener.cs 92.74% 9 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
unittests-Instrumentation.ElasticsearchClient 85.76% <93.12%> (+5.39%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...lient/ElasticsearchClientInstrumentationOptions.cs 100.00% <100.00%> (ø)
.../ElasticsearchRequestPipelineDiagnosticListener.cs 88.23% <92.74%> (+3.98%) ⬆️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md Outdated
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.

Copilot AI 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.

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.

Comment thread src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md
@martincostello martincostello marked this pull request as ready for review July 2, 2026 10:12
@martincostello martincostello requested a review from a team as a code owner July 2, 2026 10:12
@github-actions github-actions Bot requested a review from ejsmith July 3, 2026 11:17
@martincostello martincostello marked this pull request as draft July 8, 2026 08:29
Comment thread src/OpenTelemetry.Instrumentation.ElasticsearchClient/README.md Outdated
Comment thread src/OpenTelemetry.Instrumentation.ElasticsearchClient/README.md Outdated
Comment thread src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md Outdated
Comment thread src/OpenTelemetry.Instrumentation.ElasticsearchClient/CHANGELOG.md Outdated
@martincostello martincostello marked this pull request as ready for review July 8, 2026 09:12
@martincostello martincostello added the keep-open Prevents issues and pull requests being closed as stale label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:instrumentation.elasticsearchclient Things related to OpenTelemetry.Instrumentation.ElasticsearchClient keep-open Prevents issues and pull requests being closed as stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature request] replace usages of net.peer.* with server.* [feature request] ElasticSearch - update network semantic convention

3 participants