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";
    }
}

@@ -50,16 +50,62 @@
 urces;%0A%0A
+import com.hypnoticocelot.telemetry.SpanData;%0A
 import c
@@ -441,24 +441,37 @@
  Span.start(
+new SpanData(
 %22sleep 1%22)) 
@@ -465,24 +465,25 @@
 (%22sleep 1%22))
+)
  %7B%0A         
@@ -547,24 +547,37 @@
  Span.start(
+new SpanData(
 %22sleep 2%22)) 
@@ -575,16 +575,17 @@
 eep 2%22))
+)
  %7B%0A     
@@ -649,32 +649,45 @@
 an = Span.start(
+new SpanData(
 %22sleep 3%22)) %7B%0A  
@@ -681,16 +681,17 @@
 eep 3%22))
+)
  %7B%0A     
@@ -756,16 +756,29 @@
 n.start(
+new SpanData(
 %22sleep 3
@@ -782,16 +782,17 @@
 p 3.1%22))
+)
  %7B%0A     

Fix TracedResource to work with SpanData.