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

logging: add WithErrorFields #734

Merged

Conversation

kindermoumoute
Copy link
Contributor

WithErrorFields allows to extract logging fields from an error.

Typically to add a stack trace field or more context around the error.

Changes

  • logging: add a new WithErrorFields option
  • testpb: add wrappedErrFields and helpers to inject / extract fields
  • testpb: PingError return a wrappedErrFields

Verification

In PingError test (logging interceptor), assertion on finished fields show "error-field" is present and set to the correct value.

WithErrorFields allows to extract logging fields from an error.
Typically to add a stack trace field or more context around the error.

Signed-off-by: Olivier Cano <[email protected]>
Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Sure, sounds good to me!

@johanbrandhorst johanbrandhorst merged commit a78cb17 into grpc-ecosystem:main Dec 1, 2024
6 of 7 checks passed
@kindermoumoute kindermoumoute deleted the with-error-fields branch December 1, 2024 19:24
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