Skip to content

fix(opentelemetry_grpc): set error.type to the gRPC status code name - #893

Merged
yordis merged 22 commits into
open-telemetry:mainfrom
yordis:yordis/fix-grpc-error-type-status-code
Dec 3, 2026
Merged

yordis merged 22 commits into
open-telemetry:mainfrom
yordis:yordis/fix-grpc-error-type-status-code

Conversation

@yordis

@yordis yordis commented Nov 17, 2026 •

Copy link
Copy Markdown
Member
  • The gRPC semantic conventions say error.type SHOULD be the status code name, such as INTERNAL, when a call ends with an error status, and the exception type or _OTHER only when it fails before any status comes back. The spans set it to the exception module or a status integer instead, so failures could not be grouped by the code the caller saw, and the same failure grouped differently on the client and the server.
  • A raised GRPC.RPCError on the client carries a status code, so it should be named by that code like a returned one, not by its module.
  • A status code grpc has no name for crashed GRPC.Status.code_name/1 inside the handler, which detached it permanently.
  • An exception returned by a client interceptor should be named by its module and described by its message, not by its inspected struct.
  • A thrown or exited term is arbitrary, so it does not describe the error and the span description stays empty.

@GregMefford GregMefford 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.

It looks like this should be rebased onto main after the previous one got merged. I wasn't clear about the current status based on the description mentioning only the 4 last commits being new and I see a lot of commits here.

…led calls

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ilures group by what the caller saw

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…tion message

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ion message, as the conventions ask

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…e semantic conventions package

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…urns a non-RPCError error

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…non-RPCError error, as the conventions require on failure

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…mantic conventions that define them

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ception without the Elixir prefix

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ay Elixir writes it

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…e grpc has no name for

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…me for instead of detaching the handler

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…o be named by its status code

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ts status code

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ils with throw or exit

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ll fails with throw or exit

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
… fails with throw or exit

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ndler fails with throw or exit

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
…ion to be named and described by it

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
… an exception by that exception

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
… way as a returned one

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis force-pushed the yordis/fix-grpc-error-type-status-code branch from 3dc127d to f303fc2 Compare November 25, 2026 03:35
@yordis
yordis requested a review from GregMefford November 25, 2026 03:48

@GregMefford GregMefford 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.

Sorry it took so long to get back to this review. Just one more thing that I think we should fix before we ship it!

…ormalize to

An error raised with a non-exception reason, like :badarith, fell through to the
throw/exit handling and lost its exception event and description.

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@yordis
yordis requested a review from GregMefford December 3, 2026 03:51
@yordis

yordis commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

@GregMefford ready again!

@yordis
yordis merged commit 35728ab into open-telemetry:main Dec 3, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants