Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support loggging grpc status details #637

Open
devnev opened this issue Sep 13, 2023 · 4 comments
Open

Support loggging grpc status details #637

devnev opened this issue Sep 13, 2023 · 4 comments
Labels

Comments

@devnev
Copy link
Collaborator

devnev commented Sep 13, 2023

Problem

GRPC status messages on the wire are protos and include a field called details that allows further protos to be attached to the results - see https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto#L91

Example of such an additions are in the error_details.proto file https://github.com/googleapis/googleapis/blob/master/google/rpc/error_details.proto

In particular, ErrorInfo can have extended error details and metadata that would be helpful to log

In v1, these could be extracted and added to the fields using the custom message producer option

Suggestion

Probably not a custom message producer like v1, but some kind of option to extend fields with error details or more generally with post-call fields

@devnev devnev added the v2 label Sep 13, 2023
@johanbrandhorst
Copy link
Collaborator

Hi, thanks for your issue! I'm a little confused exactly what the proposal is here - are we talking about a new option, or some sort of automatic behaviour? Could you share an example of the API you'd like to see, what it would do, and alternatives you've considered? Thanks!

@kwargs
Copy link

kwargs commented Jun 13, 2024

I've encountered the same problem . I want to view error details in the logs since they contain useful information for debugging. However, I haven't found a clear way to configure a logging interceptor.

It would be great to have a logging.Option to control what error details are displayed in the logs. Something like this:

// ErrorToDetails is a function type that extracts details from an error.
// It allows logging of error details when needed.
type ErrorToDetails func(err error) Fields

I'm unsure whether enabling such a function by default is a good idea, as error details might contain private information.

@kwargs
Copy link

kwargs commented Jul 16, 2024

Hi,
Do you have any other API suggestions?
I'd be happy to prepare a pull request to implement them if that would be more convenient for you.

@johanbrandhorst
Copy link
Collaborator

I'd be happy to review a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants