package com.hypnoticocelot.telemetry.example.resources;

import com.hypnoticocelot.telemetry.tracing.Span;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/traced")
@Produces(MediaType.TEXT_PLAIN)
public class TracedResource {
    @GET
    public String traceThis() throws InterruptedException {
        try (Span span = Span.start("sleep 1")) {
            Thread.sleep(100);
        }

        try (Span span = Span.start("sleep 2")) {
            Thread.sleep(100);
        }

        try (Span span = Span.start("sleep 3")) {
            Thread.sleep(40);
            try (Span span2 = Span.start("sleep 3.1")) {
                Thread.sleep(20);
            }
            Thread.sleep(10);
        }

        return "This has been a traced request";
    }
}

package com.hypnoticocelot.telemetry.example.resources;

import com.hypnoticocelot.telemetry.SpanData;
import com.hypnoticocelot.telemetry.tracing.Span;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

@Path("/traced")
@Produces(MediaType.TEXT_PLAIN)
public class TracedResource {
    @GET
    public String traceThis() throws InterruptedException {
        try (Span span = Span.start(new SpanData("sleep 1"))) {
            Thread.sleep(100);
        }

        try (Span span = Span.start(new SpanData("sleep 2"))) {
            Thread.sleep(100);
        }

        try (Span span = Span.start(new SpanData("sleep 3"))) {
            Thread.sleep(40);
            try (Span span2 = Span.start(new SpanData("sleep 3.1"))) {
                Thread.sleep(20);
            }
            Thread.sleep(10);
        }

        return "This has been a traced request";
    }
}

Fix TracedResource to work with SpanData.