Skip to content

Commit

Permalink
Add traceparent header to wave & tower clients (#5725) [ci fast]
Browse files Browse the repository at this point in the history

Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso authored Feb 4, 2025
1 parent 18a9aee commit 7eea9f2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/nextflow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions plugins/nf-wave/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit 7eea9f2

Please sign in to comment.