Suppressing Auto Instrumentation Conditionally #6887
-
In some conditions, we want to disable auto-instrumentation for an execution path. We mainly aim to reduce the amount of spans generated by some execution flows by aggregating/batching them into one span. Let me explain it in a small snippet. For instance, in the following snippet, we have the 'getPricesByIds' function which can be used to fetch 50 price documents from Couchbase via 50 database calls. In this case, auto instrumentation produces 50 child spans for each Couchbase call. Is there a way in which I can generate only one span for this operation instead of 50 without disabling the whole Couchbase instrumentation? I don't know but is there some sort of suppress signal we can use in public List<Price> getPricesByIds(List<String> ids) {
return ids.stream().map(priceRepository::getByID).collect(Collectors.toList());
}
public Price getPriceById(String id) {
return priceRepository.getByID(id);
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
check out open-telemetry/opentelemetry-specification#530 as a short-term solution, if you are using (the default) parent-based sampler, I think you can do
the key above is |
Beta Was this translation helpful? Give feedback.
check out open-telemetry/opentelemetry-specification#530
as a short-term solution, if you are using (the default) parent-based sampler, I think you can do
the key above is
TraceFlags.getDefault()
is non-recording (compared toTraceFlags.getSampled()