This repository was archived by the owner on May 23, 2023. It is now read-only.

Description
I would like to trace slow operations only.
There is a manually chosen threshold to determine whether operation slow or not.
I haven't found any description about the correct way to implement it in your documentation, but what came to my mind is:
final long startTime = System.nanoTime();
Scope scope = tracer.buildSpan(operationName).startActive(true);
try {
//do some work
} finally {
long durationInMillis = (System.nanoTime() - startTime) / 1000000;
if (durationInMillis < THE_THRESHOLD_IN_MILLS) {
scope = null;
} else {
scope.close();
}
}
Is it the correct way to drop the spans? If not, what is the correct one?