Skip to content

[gRPC] Update Semantic Conventions for client instrumentations#4338

Merged
martincostello merged 9 commits into
open-telemetry:mainfrom
martincostello:gh-4335
May 5, 2026
Merged

[gRPC] Update Semantic Conventions for client instrumentations#4338
martincostello merged 9 commits into
open-telemetry:mainfrom
martincostello:gh-4335

Conversation

@martincostello

@martincostello martincostello commented May 1, 2026

Copy link
Copy Markdown
Member

Fixes #4335
Contributes to #4064

Changes

  • Update to v1.41.0 of the gRPC Semantic Conventions.
  • Add net8.0 and net10.0 TFMs for GrpcCore instrumentation.
  • Improve gRPC test server fixture.
  • Improve GrpcCore tests.
  • Remove obsolete code.
  • Unskip tests that pass.
  • Apply Visual Studio refactor suggestions.
  • Add net462 target to GrpcCore tests.
  • Fix broken behaviour in GrpcCore for .NET Framework found through testing.

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 to v1.14.0 of the gRPC Semantic Conventions.
- Improve gRPC test server fixture.
- Remove obsolete code.
- Unskip tests that pass.

Resolves open-telemetry#4335.
Contributes to open-telemetry#4064.
@github-actions github-actions Bot added the comp:instrumentation.grpcnetclient Things related to OpenTelemetry.Instrumentation.GrpcNetClient label May 1, 2026
@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.36145% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.90%. Comparing base (58b0b61) to head (6fca15a).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ent/Implementation/GrpcClientDiagnosticListener.cs 82.35% 6 Missing ⚠️
...OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs 95.83% 1 Missing ⚠️
...tation.GrpcCore/TracerProviderBuilderExtensions.cs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4338      +/-   ##
==========================================
- Coverage   76.12%   75.90%   -0.22%     
==========================================
  Files         466      466              
  Lines       18635    18695      +60     
==========================================
+ Hits        14185    14190       +5     
- Misses       4450     4505      +55     
Flag Coverage Δ
unittests-Contrib.Shared.Tests 89.52% <ø> (+0.03%) ⬆️
unittests-Exporter.Geneva 54.84% <ø> (-0.52%) ⬇️
unittests-Exporter.InfluxDB 95.81% <ø> (ø)
unittests-Exporter.Instana 92.00% <ø> (ø)
unittests-Exporter.OneCollector 94.61% <ø> (ø)
unittests-Extensions 90.78% <ø> (ø)
unittests-Extensions.Enrichment 100.00% <ø> (ø)
unittests-Extensions.Enrichment.AspNetCore 86.27% <ø> (ø)
unittests-Extensions.Enrichment.Http 94.33% <ø> (ø)
unittests-Instrumentation.AWS 85.22% <ø> (ø)
unittests-Instrumentation.AspNet 78.04% <ø> (+1.05%) ⬆️
unittests-Instrumentation.AspNetCore 70.62% <ø> (-0.18%) ⬇️
unittests-Instrumentation.Cassandra 92.85% <ø> (ø)
unittests-Instrumentation.ConfluentKafka 78.52% <ø> (ø)
unittests-Instrumentation.ElasticsearchClient 80.60% <ø> (ø)
unittests-Instrumentation.EntityFrameworkCore 81.39% <ø> (ø)
unittests-Instrumentation.EventCounters 77.27% <ø> (ø)
unittests-Instrumentation.GrpcCore 91.34% <95.83%> (+0.07%) ⬆️
unittests-Instrumentation.GrpcNetClient 79.09% <82.85%> (+5.30%) ⬆️
unittests-Instrumentation.Hangfire 88.91% <ø> (ø)
unittests-Instrumentation.Http 74.62% <ø> (ø)
unittests-Instrumentation.Owin 88.62% <ø> (ø)
unittests-Instrumentation.Process 100.00% <ø> (ø)
unittests-Instrumentation.Quartz 78.76% <ø> (ø)
unittests-Instrumentation.Remoting 66.06% <ø> (ø)
unittests-Instrumentation.Runtime 100.00% <ø> (ø)
unittests-Instrumentation.ServiceFabricRemoting 40.83% <ø> (ø)
unittests-Instrumentation.SqlClient 84.36% <ø> (ø)
unittests-Instrumentation.StackExchangeRedis 93.78% <ø> (ø)
unittests-Instrumentation.Wcf 81.57% <ø> (ø)
unittests-OpAmp.Client 84.25% <ø> (-0.73%) ⬇️
unittests-PersistentStorage 65.00% <ø> (-5.42%) ⬇️
unittests-Resources.AWS 74.49% <ø> (ø)
unittests-Resources.Azure 88.31% <ø> (ø)
unittests-Resources.Container 67.34% <ø> (ø)
unittests-Resources.Gcp 71.42% <ø> (ø)
unittests-Resources.Host 72.26% <ø> (ø)
unittests-Resources.OperatingSystem 76.98% <ø> (ø)
unittests-Resources.Process 100.00% <ø> (ø)
unittests-Resources.ProcessRuntime 79.59% <ø> (ø)
unittests-Sampler.AWS 96.39% <ø> (ø)

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

Files with missing lines Coverage Δ
...strumentation.GrpcCore/ClientTracingInterceptor.cs 88.64% <100.00%> (+0.18%) ⬆️
...enTelemetry.Instrumentation.GrpcCore/Extensions.cs 100.00% <100.00%> (ø)
...nstrumentation.GrpcCore/GrpcCoreInstrumentation.cs 100.00% <100.00%> (ø)
...strumentation.GrpcCore/ServerTracingInterceptor.cs 97.80% <100.00%> (ø)
...n.GrpcNetClient/TracerProviderBuilderExtensions.cs 100.00% <100.00%> (ø)
...OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs 93.61% <95.83%> (-0.14%) ⬇️
...tation.GrpcCore/TracerProviderBuilderExtensions.cs 0.00% <0.00%> (ø)
...ent/Implementation/GrpcClientDiagnosticListener.cs 85.13% <82.35%> (+7.52%) ⬆️

... and 13 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.

- Update to v1.14.0 of the gRPC Semantic Conventions.
- Add `net10.0` TFM.
- Improve gRPC tests.
- Apply Visual Studio refactor suggestoins.

Contributes to open-telemetry#4064.
@martincostello martincostello changed the title [GrpcNetClient] Update Semantic Conventions [Grpc] Update Semantic Conventions for client instrumentations May 1, 2026
@github-actions github-actions Bot added the comp:instrumentation.grpccore Things related to OpenTelemetry.Instrumentation.GrpcCore label May 1, 2026
@martincostello martincostello changed the title [Grpc] Update Semantic Conventions for client instrumentations [gRPC] Update Semantic Conventions for client instrumentations May 1, 2026
Fix copy-paste typo from Grpc.Core.Api.
Add `net8.0` too.
@martincostello
martincostello marked this pull request as ready for review May 1, 2026 13:47
Copilot AI review requested due to automatic review settings May 1, 2026 13:48
@martincostello
martincostello requested a review from a team as a code owner May 1, 2026 13:48

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

This PR updates the gRPC client instrumentations (GrpcNetClient and GrpcCore) to align with RPC semantic conventions v1.41.0, including attribute key updates and adding ActivitySource schema URLs / scope versions, and refreshes tests/fixtures accordingly.

Changes:

  • Update span attributes to semantic conventions v1.41.0 (e.g., rpc.system.name, rpc.response.status_code, server.address handling for IPs).
  • Standardize ActivitySource creation via ActivitySourceFactory to include scope version and schema URL.
  • Improve and unskip gRPC tests, including a new shared TCP port helper and server fixture updates; add net8.0/net10.0 TFMs for GrpcCore.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/Shared/TcpPortProvider.cs New shared helper to obtain an OS-assigned loopback port for tests.
test/OpenTelemetry.Instrumentation.GrpcNetClient.Tests/OpenTelemetry.Instrumentation.GrpcNetClient.Tests.csproj Links the new shared TcpPortProvider into the test project.
test/OpenTelemetry.Instrumentation.GrpcNetClient.Tests/GrpcTests.server.cs Updates server-side test assertions to newer HTTP/RPC semantic convention attributes and uses server Address.
test/OpenTelemetry.Instrumentation.GrpcNetClient.Tests/GrpcTests.client.cs Updates client-side assertions for new RPC attributes and server.address behavior; adjusts skip conditions.
test/OpenTelemetry.Instrumentation.GrpcNetClient.Tests/GrpcServer.cs Refactors test server fixture to use a generated address/port and expose a Uri Address.
test/OpenTelemetry.Instrumentation.GrpcCore.Tests/InterceptorActivityListener.cs Updates ActivityListener wiring/sampling logic for GrpcCore tests.
test/OpenTelemetry.Instrumentation.GrpcCore.Tests/GrpcCoreServerInterceptorTests.cs Tightens validation by asserting expected gRPC method names per call type.
test/OpenTelemetry.Instrumentation.GrpcCore.Tests/GrpcCoreClientInterceptorTests.cs Updates common tag validation to new RPC semantic conventions and explicit method naming.
test/OpenTelemetry.Instrumentation.GrpcCore.Tests/FoobarService.cs Minor refactors/formatting adjustments in test service implementation.
src/Shared/SemanticConventions.cs Adds rpc.response.status_code constant for updated RPC semantic conventions.
src/OpenTelemetry.Instrumentation.GrpcNetClient/TracerProviderBuilderExtensions.cs Uses ActivitySource instance name instead of a separate constant.
src/OpenTelemetry.Instrumentation.GrpcNetClient/README.md Updates supported framework wording.
src/OpenTelemetry.Instrumentation.GrpcNetClient/OpenTelemetry.Instrumentation.GrpcNetClient.csproj Includes shared ActivitySourceFactory in the build.
src/OpenTelemetry.Instrumentation.GrpcNetClient/Implementation/GrpcClientDiagnosticListener.cs Updates ActivitySource creation + emitted tags to v1.41.0; fixes server.address for IP endpoints.
src/OpenTelemetry.Instrumentation.GrpcNetClient/CHANGELOG.md Documents breaking semantic convention update + schema URL/scope version addition.
src/OpenTelemetry.Instrumentation.GrpcCore/TracerProviderBuilderExtensions.cs Uses ActivitySource instance name instead of a separate constant.
src/OpenTelemetry.Instrumentation.GrpcCore/ServerTracingInterceptor.cs Passes context.Host into the scope for server.address tagging.
src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs Updates tag keys to v1.41.0, adds server.address setting, and improves null-safety around stopping/adding events.
src/OpenTelemetry.Instrumentation.GrpcCore/OpenTelemetry.Instrumentation.GrpcCore.csproj Adds modern TFMs and includes shared ActivitySourceFactory.
src/OpenTelemetry.Instrumentation.GrpcCore/GrpcCoreInstrumentation.cs Switches ActivitySource creation to ActivitySourceFactory with schema URL support.
src/OpenTelemetry.Instrumentation.GrpcCore/Extensions.cs Refactors best-effort disposal helper for clarity.
src/OpenTelemetry.Instrumentation.GrpcCore/ClientTracingInterceptor.cs Passes host into scope and refactors context storage.
src/OpenTelemetry.Instrumentation.GrpcCore/CHANGELOG.md Documents breaking semantic convention update + schema URL/scope version + new TFMs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs
Comment thread test/Shared/TcpPortProvider.cs Outdated
Comment thread test/OpenTelemetry.Instrumentation.GrpcNetClient.Tests/GrpcServer.cs Outdated
- Fix `server.address` handling.
- Remove redundant TFM.
- Fix typo.
- Make property setter private.
Comment thread src/OpenTelemetry.Instrumentation.GrpcCore/CHANGELOG.md Outdated
- Test the library actually works on .NET Framework.
- Fix test failures.
Handle `ApplicationException` for an invalid handle on .NET Framework.
@Kielek

Kielek commented May 5, 2026

Copy link
Copy Markdown
Member

@IliaBrahinets, @pcwiese any opinions here?

Comment thread src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs
Comment thread src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs Outdated
- Use `Uri.TryParse()` to parse host and port.
- Move parsing to its own method.
- Add constants for client method names.
@martincostello
martincostello added this pull request to the merge queue May 5, 2026
Merged via the queue into open-telemetry:main with commit f79b7e3 May 5, 2026
625 of 628 checks passed
@martincostello
martincostello deleted the gh-4335 branch May 5, 2026 11:35
@Matus-p

Matus-p commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@martincostello in semconv 1.41 ( https://opentelemetry.io/docs/specs/semconv/rpc/grpc/ ) there is no rpc.service. The rpc.method should contain full name like com.example.ExampleService/exampleMethod

i think these lines should be updated:

@martincostello

Copy link
Copy Markdown
Member Author

@Matus-p Would you like to submit a PR?

@Matus-p

Matus-p commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@Matus-p Would you like to submit a PR?

sorry, no, it would be just a blind fix, i can't even run your test suite

@martincostello

Copy link
Copy Markdown
Member Author

i can't even run your test suite

Well that's a problem itself - can you share more details about what's not working so we can fix it?

@Matus-p

Matus-p commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

i can't even run your test suite

Well that's a problem itself - can you share more details about what's not working so we can fix it?

ok, i will create a PR and then we can continue from there

@martincostello

Copy link
Copy Markdown
Member Author

@Matus-p I've opened #4508 to fix the issue, but we'd still welcome a PR to fix whatever issue you're having trying to run the tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:instrumentation.grpccore Things related to OpenTelemetry.Instrumentation.GrpcCore comp:instrumentation.grpcnetclient Things related to OpenTelemetry.Instrumentation.GrpcNetClient

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] gRPC client instrumentation uses server.socket.address attribute for IP addresses

6 participants