Skip to content

fix(otelgrpc): use SCREAMING_SNAKE_CASE for rpc.response.status_code attribute https://github.com/open-telemetry/opentelemetry-go-contrib/issues/8543#8575

Closed
anayagam wants to merge 1 commit into
open-telemetry:mainfrom
anayagam:bugfix-otelgrpc
Closed

fix(otelgrpc): use SCREAMING_SNAKE_CASE for rpc.response.status_code attribute https://github.com/open-telemetry/opentelemetry-go-contrib/issues/8543#8575
anayagam wants to merge 1 commit into
open-telemetry:mainfrom
anayagam:bugfix-otelgrpc

Conversation

@anayagam
Copy link
Copy Markdown

  • New grpcCodeString(c grpc_codes.Code) string function with a full switch over all 17 gRPC codes returning SCREAMING_SNAKE_CASE strings Lines 374/376: replaced s.Code().String() / grpc_codes.OK.String() with grpcCodeString(s.Code()) / grpcCodeString(grpc_codes.OK) stats_handlertest_test.go
    — Added a local grpcCodeToString() mirror function (needed since the production function is unexported) and updated assertServerSpan and assertStatsHandlerServerMetrics to use it. grpc_stats_handler_test.go
    — Replaced all codes.OK.String() with the literal "OK" string. Added a Fixed entry referencing issue [Bug]: otelgrpc uses PascalCase status codes, spec uses SCREAMING_SNAKE_CASE #8543.
  • Key mapping note: grpc_codes.Canceled → "CANCELLED" (note the double-L) , this matches the gRPC/OTel spec spelling.

New grpcCodeString(c grpc_codes.Code) string function with a full switch over all 17 gRPC codes returning SCREAMING_SNAKE_CASE strings
Lines 374/376: replaced s.Code().String() / grpc_codes.OK.String() with grpcCodeString(s.Code()) / grpcCodeString(grpc_codes.OK)
stats_handlertest_test.go — Added a local grpcCodeToString() mirror function (needed since the production function is unexported) and updated assertServerSpan and assertStatsHandlerServerMetrics to use it.
grpc_stats_handler_test.go — Replaced all codes.OK.String() with the literal "OK" string.
Added a Fixed entry referencing issue open-telemetry#8543.
Key mapping note: grpc_codes.Canceled → "CANCELLED" (note the double-L) , this matches the gRPC/OTel spec spelling.
@anayagam anayagam requested review from a team and dashpole as code owners February 18, 2026 17:00
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Feb 18, 2026

CLA Missing ID

@dmathieu
Copy link
Copy Markdown
Member

Duplicate of #8565

@dmathieu dmathieu marked this as a duplicate of #8565 Feb 18, 2026
@dmathieu dmathieu closed this Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants