-
Notifications
You must be signed in to change notification settings - Fork 457
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
fix(valkey): Make error checking configurable and fix inconsistency #3297
base: main
Are you sure you want to change the base?
Conversation
@@ -80,14 +83,14 @@ func (c *client) Do(ctx context.Context, cmd valkey.Completed) valkey.ValkeyResu | |||
span, ctx := c.startSpan(ctx, processCommand(&cmd)) | |||
resp := c.client.Do(ctx, cmd) | |||
setClientCacheTags(span, resp) | |||
span.Finish(tracer.WithError(resp.Error())) |
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.
A valkey nil error will get attached to the span here currently.
@keisku Please, can you check this? |
Updated this to apply same treatment to |
Thank you for fixing this. I wonder why changes other than the following are necessary. func (c *client) Do(ctx context.Context, cmd valkey.Completed) valkey.ValkeyResult {
span, ctx := c.startSpan(ctx, processCommand(&cmd))
resp := c.client.Do(ctx, cmd)
setClientCacheTags(span, resp)
- span.Finish(tracer.WithError(resp.Error()))
+ c.finishSpan(span, resp.Error())
return resp
} When do we need |
Hi @keisku , Apologies, I didn't go into detail about the addition of
We use I do see you point that this change address 2 separate concerns and could be 2 separate MRs. I can split into 2 if that is desirable. |
Appreciate you explaining it! dd-trace-go/contrib/redis/go-redis.v9/option.go Lines 79 to 85 in a95495a
Can we have the default errCheck like this? I think we can remove func defaultConfig() *config {
return &config{
// Do not include the raw command by default since it could contain sensitive data.
rawCommand: internal.BoolEnv("DD_TRACE_VALKEY_RAW_COMMAND", false),
serviceName: namingschema.ServiceName(defaultServiceName),
+ errCheck: func(err error) bool { return err != nil && !valkey.IsValkeyNil(err) },
}
} |
thank you @keisku. I have updated the PR as you described and added an additional test. |
All tracer.WithError calls first run through a configurable error check function. Apply same treatment to rueidis to maintain consistency.
All tracer.WithError calls first run through a configurable error check function.
What does this PR do?
Fixes an inconsistency in the
Do
method where errors were not being checked for valkey nil.Makes error checking configurable.
Motivation
Reviewer's Checklist
v2-dev
branch and reviewed by @DataDog/apm-go.Unsure? Have a question? Request a review!