Skip to content

[gRPC] Update gRPC Semantic Conventions to 1.42.0#4508

Merged
Kielek merged 14 commits into
open-telemetry:mainfrom
martincostello:gh-4338
Jun 22, 2026
Merged

[gRPC] Update gRPC Semantic Conventions to 1.42.0#4508
Kielek merged 14 commits into
open-telemetry:mainfrom
martincostello:gh-4338

Conversation

@martincostello

@martincostello martincostello commented Jun 12, 2026

Copy link
Copy Markdown
Member

See #4338 (comment).

Changes

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)

Fix 1.41 Semantic Conventions for gRPC:

- Remove `rpc.service`.
- Update `rpc.method` to include the service name.

See open-telemetry#4338 (comment).
@github-actions github-actions Bot added comp:instrumentation.grpccore Things related to OpenTelemetry.Instrumentation.GrpcCore comp:instrumentation.grpcnetclient Things related to OpenTelemetry.Instrumentation.GrpcNetClient labels Jun 12, 2026
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.64706% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.07%. Comparing base (b04a8ba) to head (3483091).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tation.AspNetCore/Implementation/HttpInListener.cs 96.00% 1 Missing ⚠️
src/Shared/GrpcTagHelper.cs 97.29% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4508      +/-   ##
==========================================
- Coverage   76.18%   76.07%   -0.11%     
==========================================
  Files         441      441              
  Lines       18172    18164       -8     
==========================================
- Hits        13844    13818      -26     
- Misses       4328     4346      +18     
Flag Coverage Δ
unittests-Contrib.Shared.Tests 89.93% <97.29%> (+2.01%) ⬆️
unittests-Exporter.Geneva 55.16% <ø> (-0.59%) ⬇️
unittests-Exporter.InfluxDB 95.75% <ø> (ø)
unittests-Exporter.OneCollector 95.60% <ø> (ø)
unittests-Extensions 90.61% <ø> (ø)
unittests-Extensions.Enrichment 100.00% <ø> (ø)
unittests-Extensions.Enrichment.AspNetCore 86.27% <ø> (ø)
unittests-Extensions.Enrichment.Http 94.33% <ø> (ø)
unittests-Instrumentation.AWS 85.21% <ø> (ø)
unittests-Instrumentation.AspNet 77.50% <ø> (ø)
unittests-Instrumentation.AspNetCore 87.68% <96.15%> (-0.47%) ⬇️
unittests-Instrumentation.Cassandra 92.68% <ø> (ø)
unittests-Instrumentation.ConfluentKafka 82.04% <ø> (ø)
unittests-Instrumentation.ElasticsearchClient 80.36% <ø> (ø)
unittests-Instrumentation.EntityFrameworkCore 81.02% <ø> (ø)
unittests-Instrumentation.EventCounters 77.47% <ø> (ø)
unittests-Instrumentation.GrpcCore 91.12% <100.00%> (-0.07%) ⬇️
unittests-Instrumentation.GrpcNetClient 78.09% <100.00%> (-0.41%) ⬇️
unittests-Instrumentation.Hangfire 88.83% <ø> (ø)
unittests-Instrumentation.Http 74.81% <ø> (ø)
unittests-Instrumentation.Owin 88.88% <ø> (ø)
unittests-Instrumentation.Process 100.00% <ø> (ø)
unittests-Instrumentation.Quartz 78.37% <ø> (ø)
unittests-Instrumentation.Remoting 65.59% <ø> (ø)
unittests-Instrumentation.Runtime 100.00% <ø> (ø)
unittests-Instrumentation.ServiceFabricRemoting 39.91% <ø> (ø)
unittests-Instrumentation.SqlClient 82.36% <ø> (ø)
unittests-Instrumentation.StackExchangeRedis 94.18% <ø> (ø)
unittests-Instrumentation.Wcf 82.23% <ø> (ø)
unittests-OpAmp.Client 86.71% <ø> (ø)
unittests-PersistentStorage 67.74% <ø> (-1.76%) ⬇️
unittests-Resources.AWS 73.61% <ø> (ø)
unittests-Resources.Azure 87.67% <ø> (ø)
unittests-Resources.Container 67.34% <ø> (ø)
unittests-Resources.Gcp 71.42% <ø> (ø)
unittests-Resources.Host 72.26% <ø> (ø)
unittests-Resources.OperatingSystem 76.98% <ø> (ø)
unittests-Resources.Process 90.47% <ø> (ø)
unittests-Resources.ProcessRuntime 79.59% <ø> (ø)
unittests-Sampler.AWS 95.97% <ø> (ø)

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

Files with missing lines Coverage Δ
...umentation.AspNetCore/AspNetCoreInstrumentation.cs 100.00% <100.00%> (ø)
...nstrumentation.GrpcCore/GrpcCoreInstrumentation.cs 100.00% <100.00%> (ø)
...OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs 93.33% <100.00%> (-0.22%) ⬇️
...ent/Implementation/GrpcClientDiagnosticListener.cs 84.72% <100.00%> (-0.42%) ⬇️
...tation.AspNetCore/Implementation/HttpInListener.cs 87.70% <96.00%> (-0.85%) ⬇️
src/Shared/GrpcTagHelper.cs 97.33% <97.29%> (+27.47%) ⬆️

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

@martincostello
martincostello marked this pull request as ready for review June 12, 2026 16:29
@martincostello
martincostello requested a review from a team as a code owner June 12, 2026 16:29
@martincostello
martincostello enabled auto-merge June 12, 2026 16:29
@Kielek

Kielek commented Jun 12, 2026

Copy link
Copy Markdown
Member

Haven't added a CHANGELOG entry is this is just a follow-up for unreleased changes from #4338.

Maybe you could add this after comma (#4338, #4508)?

Add extra link.
@Matus-p

Matus-p commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

i did some additional changes to adhere to 1.41 grpc semantic conventions, see this PR: martincostello#4
feel free to cherry-pick it to your PR

Comment thread src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs Outdated
@martincostello

Copy link
Copy Markdown
Member Author

i did some additional changes to adhere to 1.41 grpc semantic conventions, see this PR: martincostello#4

Thanks. I'll look to cherry-pick the relevant parts once #4370 is merged.

@martincostello martincostello changed the title [gRPC] Remove rpc.service and update rpc.method [gRPC] Update gRPC Semantic Conventions to 1.42.0 Jun 17, 2026
@martincostello
martincostello marked this pull request as draft June 17, 2026 09:18
auto-merge was automatically disabled June 17, 2026 09:18

Pull request was converted to draft

martincostello and others added 2 commits June 17, 2026 10:28
- Update to version 1.42.0 of the (g)RPC Semantic Conventions.
- Address feedback.
- Remove redundant code.

Co-Authored-By: Matus-p <81446121+matus-p@users.noreply.github.com>
Co-Authored-By: Piotr Kiełkowicz <pkielkow@cisco.com>
@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 17, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Kielek / name: Piotr Kiełkowicz (8b33f49)
  • ✅ login: Matus-p / name: Matus-p (8b33f49)
  • ✅ login: martincostello / name: Martin Costello (45f8987)
  • ✅ login: martincostello / name: martincostello (21e2618, 67a4c74, 8b33f49)

@github-actions github-actions Bot added the comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore label Jun 17, 2026
@martincostello

Copy link
Copy Markdown
Member Author

@Matus-p I incorporated your feedback from my fork. Could you sign the CLA please? Otherwise I'll need to update the latest commit message to remove your co-authorship.

@martincostello
martincostello marked this pull request as ready for review June 17, 2026 12:43
- Set the `error.type` attribute where possible.
- Add a test that illustrates a solution to open-telemetry#2066.
@martincostello
martincostello enabled auto-merge June 17, 2026 15:55
@Kielek

Kielek commented Jun 19, 2026

Copy link
Copy Markdown
Member

Codex findings

[P1] src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs:208 - GrpcCore still does not apply 1.42 gRPC client error rules. StopActivity(int) only writes rpc.response.status_code and stops, so a disposed/cancelled client call still exports CANCELLED with status unset and no error.type. v1.42 says client spans treat every non-OK status as an error. The same path also means exception failures reach StopActivity(...) without setting error.type.
[P2] src/Shared/GrpcTagHelper.cs:37 - SetGrpcMethodAndDisplayNameFromActivity maps every non-null grpc.method directly to rpc.method. The 1.42 compatibility doc says native grpc.method=other must become rpc.method=_OTHER and preserve the original in rpc.method_original; this currently emits rpc.method=other and names the span other.

- Handle "other" methods correctly.
- Avoid overwriting the status if already set.
- Set the `error.type` attribute consistently.
@Kielek

Kielek commented Jun 19, 2026

Copy link
Copy Markdown
Member

One more
[P1] src/OpenTelemetry.Instrumentation.GrpcCore/RpcScope.cs:265 - StopActivity(Exception) marks every RpcException as ActivityStatusCode.Error before StopActivity(int) applies the kind-specific gRPC status rules. For server spans, v1.42 only treats UNKNOWN, DEADLINE_EXCEEDED, UNIMPLEMENTED, INTERNAL, UNAVAILABLE, and DATA_LOSS as errors, but the current server test path uses RESOURCE_EXHAUSTED and still expects Error plus error.type. This defeats the new ResolveSpanStatusForGrpcStatusCodeOnServer(...) logic for handled server status codes.

Fix incorrect error handling.
@martincostello
martincostello disabled auto-merge June 19, 2026 14:52
@martincostello

Copy link
Copy Markdown
Member Author

Going to look at adding some weaver tests on top of the latest commit for additional verification.

Validate gRPC semantic conventions with Weaver.
@martincostello
martincostello enabled auto-merge June 19, 2026 16:31

@Kielek Kielek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more comment from Codex... I am not sure why it cannot handle at once.:
P1 test/OpenTelemetry.Instrumentation.GrpcNetClient.Tests/GrpcTests.client.cs:374
This assertion still reads SemanticConventions.AttributeRpcGrpcStatusCode (rpc.grpc.status_code), but the PR now writes rpc.response.status_code. Nearby assertions were updated correctly. This test should assert AttributeRpcResponseStatusCode, otherwise GetTagValue(...) returns null.

Add OpenTelemetry to the tests not the library.
- Fix incorrect assertion.
- Fix redundant `#if`.
- Make the assertion that fails the test last.
@martincostello
martincostello added this pull request to the merge queue Jun 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 22, 2026
@Kielek
Kielek added this pull request to the merge queue Jun 22, 2026
Merged via the queue into open-telemetry:main with commit b25e7fc Jun 22, 2026
313 checks passed
@martincostello
martincostello deleted the gh-4338 branch June 22, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore 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.

Grpc Instrumentation is broken in NET6.0 or higher, when custom propagator is used

5 participants