diff --git a/modules/nextflow/build.gradle b/modules/nextflow/build.gradle index 59c60149b0..c005504dc3 100644 --- a/modules/nextflow/build.gradle +++ b/modules/nextflow/build.gradle @@ -49,6 +49,7 @@ dependencies { api 'dev.failsafe:failsafe:3.1.0' api 'org.bouncycastle:bcprov-ext-jdk18on:1.78.1' api 'org.bouncycastle:bcpkix-jdk18on:1.78.1' + api 'io.seqera:lib-trace:0.1.0' testImplementation 'org.subethamail:subethasmtp:3.1.7' diff --git a/modules/nextflow/src/main/groovy/nextflow/util/SimpleHttpClient.groovy b/modules/nextflow/src/main/groovy/nextflow/util/SimpleHttpClient.groovy index 07ac305fa6..bb756c0af3 100644 --- a/modules/nextflow/src/main/groovy/nextflow/util/SimpleHttpClient.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/util/SimpleHttpClient.groovy @@ -20,6 +20,7 @@ package nextflow.util import groovy.json.JsonSlurper import groovy.transform.CompileStatic import groovy.util.logging.Slf4j +import io.seqera.util.trace.TraceUtils import nextflow.BuildInfo /** * Small and simple http client that sends POST requests @@ -122,6 +123,7 @@ class SimpleHttpClient { con.setRequestMethod(method) con.setRequestProperty("Content-Type", contentType) con.setRequestProperty("User-Agent", userAgent) + con.setRequestProperty("Traceparent", TraceUtils.rndTrace()) // set charset if( charset ) con.setRequestProperty("charset", "utf-8") diff --git a/plugins/nf-wave/build.gradle b/plugins/nf-wave/build.gradle index ce8c00b39d..ce8c256db1 100644 --- a/plugins/nf-wave/build.gradle +++ b/plugins/nf-wave/build.gradle @@ -32,6 +32,7 @@ dependencies { compileOnly project(':nextflow') compileOnly 'org.slf4j:slf4j-api:2.0.16' compileOnly 'org.pf4j:pf4j:3.12.0' + compileOnly 'io.seqera:lib-trace:0.1.0' api 'org.apache.commons:commons-compress:1.26.1' api 'org.apache.commons:commons-lang3:3.12.0' api 'com.google.code.gson:gson:2.10.1' diff --git a/plugins/nf-wave/src/main/io/seqera/wave/plugin/WaveClient.groovy b/plugins/nf-wave/src/main/io/seqera/wave/plugin/WaveClient.groovy index 89cbb3fe4d..36b1b561cd 100644 --- a/plugins/nf-wave/src/main/io/seqera/wave/plugin/WaveClient.groovy +++ b/plugins/nf-wave/src/main/io/seqera/wave/plugin/WaveClient.groovy @@ -48,6 +48,7 @@ import groovy.json.JsonSlurper import groovy.transform.Canonical import groovy.transform.CompileStatic import groovy.transform.Memoized +import io.seqera.util.trace.TraceUtils import io.seqera.wave.api.BuildStatusResponse import io.seqera.wave.api.ContainerStatus import io.seqera.wave.api.ContainerStatusResponse @@ -290,12 +291,13 @@ class WaveClient { request.towerAccessToken = accessToken request.towerRefreshToken = refreshToken + final trace = TraceUtils.rndTrace() final body = JsonOutput.toJson(request) final uri = URI.create("${endpoint}/v1alpha2/container") log.debug "Wave request: $uri; attempt=$attempt - request: $request" final req = HttpRequest.newBuilder() .uri(uri) - .headers('Content-Type','application/json') + .headers('Content-Type','application/json', 'Traceparent', trace) .POST(HttpRequest.BodyPublishers.ofString(body)) .build()