opentracing-contrib/java-jaxrs

Builder.withTraceNothing() doesn't seem to work

sjoerdtalsma opened this issue · 1 comments

Actually it works a little too wel, as it indeed traces nothing.
However, it promises:

/**
 * Only resources annotated with {@link Traced} will be traced.
 * @return builder
 */
public Builder withTraceNothing() {
    allTraced = false;
    return this;
}

I believe the problem is in the configure method:

public void configure(ResourceInfo resourceInfo, FeatureContext context) {
    // TODO why it is called twice for the same endpoint
    if (!tracingDisabled(resourceInfo) && builder.allTraced) {
        log(resourceInfo);
        // .. configuration
    }
}

Here, tracingDisabled concerns itself with the @Traced annotation. Therefore I think the && should be changed to || in order to fulfill the promised annotation support.
while you're at it, short-circuit on the boolean instead of the annotation search:

if (builder.allTraced || !tracingDisabled(resourceInfo)) { ...

Closing as this has been fixed and released in 0.2.1