Skip to content

Sampler.shouldSample in Redis Span The Attributes for the method parameter cannot be obtained. Why #11639

@1095071913

Description

@1095071913

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 {

@Override
public SamplingResult shouldSample(Context parentContext, String traceId, String name, SpanKind spanKind, Attributes attributes, List<LinkData> parentLinks) {

    System.out.println("name:"+name);

    attributes.forEach((key,value)->{
        System.out.println(key+":"+value);
    });

    return SamplingResult.create(SamplingDecision.RECORD_AND_SAMPLE);

}

@Override
public String getDescription() {
    return "FilterSampler";
}

}`

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

`
io.opentelemetry.javaagent
opentelemetry-javaagent
2.4.0

<dependency>
  <groupId>io.opentelemetry</groupId>
  <artifactId>opentelemetry-sdk-extension-autoconfigure</artifactId>
  <version>1.38.0</version>
</dependency>

<dependency>
  <groupId>io.micrometer</groupId>
  <artifactId>micrometer-tracing-bridge-otel</artifactId>
  <version>1.3.1</version>
</dependency>`

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions