Closed 1095071913 closed 2 days ago
In sampler you can only use the attributes that are available when the span is started. The db.statement
attribute you wish to use is set later.
在采样器中,您只能使用跨度启动时可用的属性。您要使用的属性
db.statement
稍后设置。
@laurit Sorry to interrupt. How should the db.statement attribute be set
Have a look at https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/lettuce/lettuce-5.1/library/src/main/java/io/opentelemetry/instrumentation/lettuce/v5_1/OpenTelemetryTracing.java For the attribute to be available for sampling it should be set on the SpanBuilder
before calling startSpan
. As you can see the way OpenTelemetryTracing
behaves is different for lettuce 6+ and earlier versions. It seems to me that the 6+ support could be adapted to set db.statement
before starting the span. Alternatively you could try doing the sampling in the collector.
Have a look at https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/lettuce/lettuce-5.1/library/src/main/java/io/opentelemetry/instrumentation/lettuce/v5_1/OpenTelemetryTracing.java For the attribute to be available for sampling it should be set on the
SpanBuilder
before callingstartSpan
. As you can see the wayOpenTelemetryTracing
behaves is different for lettuce 6+ and earlier versions. It seems to me that the 6+ support could be adapted to setdb.statement
before starting the span. Alternatively you could try doing the sampling in the collector.
@laurit I have a question, will lettuce open db.statement in future versions? At the moment there is redission and there is no lettuce, which would be a bit strange
@laurit I have a question, will lettuce open db.statement in future versions?
It is possible if someone submits a PR.
At the moment there is redission and there is no lettuce, which would be a bit strange
I don't follow this
@laurit I have a question, will lettuce open db.statement in future versions?
It is possible if someone submits a PR.
At the moment there is redission and there is no lettuce, which would be a bit strange
I don't follow this
Thanks for the help, through your program has been solved
Describe the bug
Sampler.shouldSample in Redis Span The Attributes for the method parameter cannot be obtained. Why
original:
thread.name=lettuce-nioEventLoop-5-3, thread.id=117, network.type=ipv4, network.peer.port=6379, server.port=6379, db.statement=INFO server, db.system=redis, network.peer.address=127.0.0.1, server.address=redis
Attributes parameter in Sampler.shouldSample: network.type=ipv4 network.peer.port=6379 server.port=6379 db.system=redis network.peer.address=127.0.0.1 server.address=redis
Why can't I get some values, such as db.statement
Steps to reproduce
`public class FilterSampler implements Sampler {
}`
Expected behavior
I want to filter some spans, such as db.statement=INFO server or db.statement=PING
Actual behavior
.
Javaagent or library instrumentation version
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/tag/v2.4.0
Environment
sampler project environment
`
Additional context
No response