[Bug] When SW_AGENT_SAMPLE is set to less than 1, go-redis catches an err: go-redis :skyWalking failed to create exit span, got error: span type is wrong
Search before asking
- [X] I had searched in the issues and found no similar issues.
Apache SkyWalking Component
Go Agent (apache/skywalking-go)
What happened
I work in an environment that uses Redis.cluster,and set SW_AGENT_SAMPLE="0.1" , then when I use my redis client to execute a command like Ping, I get err:
skyWalking failed to create exit span, got error: span type is wrong
What you expected to happen
I don't know if I can ignore this error, but I don't think my redis business should be affected by skywalking broken.
How to reproduce
1, Using the redis cluster
2, Set the environment configuration to
export SW_AGENT_SAMPLE="0.1"
3, exec redisCluster.Ping(ctx).Err() i get err
I traced the stack, in the createSpan0 method in the core trace.go file, to return newNoopSpan() due to sampling, as follows:
// Try to sample when it is not force sample if parentSpan == nil && !isForceSample { // Force sample sampled := t.Sampler.IsSampled(ds.OperationName) if !sampled { // Filter by sample just return noop span return newNoopSpan(), nil } }
This gives me the errors.New("span type is wrong") error downstream,Mainly in Redis hooks I have to get err, but I don't expect to.It's affecting my business logic.
Maybe it's a go-redis/v9 plugin bug?
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- [ ] Yes I am willing to submit a pull request on my own!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct