-
Notifications
You must be signed in to change notification settings - Fork 437
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
contrib/google.golang.org/grpc: add WithErrorCheck
option
#2035
base: main
Are you sure you want to change the base?
Conversation
c39258b
to
057eaab
Compare
NonErrorFunc
option for interceptor
NonErrorFunc
option for interceptorNonErrorFunc
option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @BIwashi, thank you for the contribution! I think it wouldn't hurt to add some unit tests covering the NonErrorFunc
option.
@dianashevchenko |
var ( | ||
rig *rig | ||
err error | ||
) | ||
if tt.nonErrorFunc == nil { | ||
rig, err = newRig(true) | ||
} else { | ||
rig, err = newRig(true, NonErrorFunc(tt.nonErrorFunc)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var ( | |
rig *rig | |
err error | |
) | |
if tt.nonErrorFunc == nil { | |
rig, err = newRig(true) | |
} else { | |
rig, err = newRig(true, NonErrorFunc(tt.nonErrorFunc)) | |
} | |
var opts []Option | |
if tt.nonErrorFunc != nil { | |
opts = append(opts, NonErrorFunc(tt.nonErrorFunc)) | |
} | |
rig, err := newRig(true, opts...) |
mt := mocktracer.Start() | ||
defer mt.Stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the start of the mocktracer this into the test case run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct revision of your point?
4fca224
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on proposal here: #2043 (comment)
I apologize for the delay in making the corrections. It would be much appreciated if you could take the time to review the revisions again. Thanks. |
NonErrorFunc
optionWithErrorCheck
option
WithErrorCheck
optionWithErrorCheck
option
What does this PR do?
This PR adds a new option called
WithErrorCheck
which allows users to set a custom function to determine whether an error should not be considered as an error for tracing purposes before sending it to DataDog.Motivation
There are cases where an application produces errors, but they should not be sent to DataDog as errors. While the
WithErrorCheck
option allows for not treating specific gRPC status codes as errors, there are use cases where a more granular decision is needed based on the specific error, rather than just the status code.For example, a user might want to consider a NotFound error as non-error for a specific RPC.
example
Describe how to test/QA your changes
Unit tests are included.
Reviewer's Checklist