[gRPC] Update Semantic Conventions for client instrumentations#4338
Conversation
- 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.
- 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.
Fix copy-paste typo from Grpc.Core.Api.
Add `net8.0` too.
There was a problem hiding this comment.
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.addresshandling for IPs). - Standardize ActivitySource creation via
ActivitySourceFactoryto 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.0TFMs 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.
- Fix `server.address` handling. - Remove redundant TFM. - Fix typo. - Make property setter private.
Address review feedback.
- Test the library actually works on .NET Framework. - Fix test failures.
Handle `ApplicationException` for an invalid handle on .NET Framework.
|
@IliaBrahinets, @pcwiese any opinions here? |
- Use `Uri.TryParse()` to parse host and port. - Move parsing to its own method. - Add constants for client method names.
f79b7e3
|
@martincostello in semconv 1.41 ( https://opentelemetry.io/docs/specs/semconv/rpc/grpc/ ) there is no i think these lines should be updated: |
|
@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 |
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 |
Fixes #4335
Contributes to #4064
Changes
Addnet8.0andnet10.0TFMs for GrpcCore instrumentation.net462target to GrpcCore tests.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changesChanges in public API reviewed (if applicable)