instana-java-opentracing icon indicating copy to clipboard operation
instana-java-opentracing copied to clipboard

Please update docs/examples to current major release on website.

Open JRW2252 opened this issue 6 years ago • 2 comments

The code on the public facing site doesn't compile with current release version. Please either update the examples on the site so it compiles with v0.33.0, or please annotate that all the examples provided will only compile/work with ~v0.31.0. The most recent major release breaks nearly all examples on the site. 👎

public static Scope startServerSpan(Tracer tracer, javax.ws.rs.core.HttpHeaders httpHeaders,
        String operationName) {
    // format the headers for extraction
    MultivaluedMap<String, String> rawHeaders = httpHeaders.getRequestHeaders();
    final HashMap<String, String> headers = new HashMap<String, String>();
    for (String key : rawHeaders.keySet()) {
        headers.put(key, rawHeaders.get(key).get(0));
    }

    Tracer.SpanBuilder spanBuilder;
    try {
        // this doesn't compile w 0.32.0 + 
        SpanContext parentSpan = tracer.extract(Format.Builtin.HTTP_HEADERS, new TextMapExtractAdapter(headers));
        if (parentSpan == null) {
            spanBuilder = tracer.buildSpan(operationName);
        } else {
            spanBuilder = tracer.buildSpan(operationName).asChildOf(parentSpan);
        }
    } catch (IllegalArgumentException e) {
        spanBuilder = tracer.buildSpan(operationName);
    }
    // this doesn't compile w 0.32.0 + 
    return spanBuilder.withTag(Tags.SPAN_KIND.getKey(), Tags.SPAN_KIND_SERVER).startActive(true);

JRW2252 avatar May 10 '19 17:05 JRW2252

Thanks for letting us know @JRW2252 - unfortunately open tracing releases do that with every minor release. We will update the examples and also mention the version.

CodingFabian avatar May 10 '19 17:05 CodingFabian

Support for version 0.32 and 0.33 has been released. Needs Java Trace Sensor 1.2.304 on the Instana Agent side

CodingFabian avatar Aug 01 '19 09:08 CodingFabian