I have a scala function to which i am trying to add some tracing in gcp stackdriver but this is the error I am facing its a data-proc job running in airflow
FAILED with error java.lang.IllegalStateException: getTransportChannel() called when needsExecutor() is true
def recreatePrimaryTable(kind: PrimaryTableKind): DataFrame = { // scalastyle:ignore method.length
println("check if the function is starting")
println(s"Recreating ${kind.name} df")
val traceClient = TraceServiceClient.create()
// Set the project ID
val projectId: String = "dv01-23151"
val credentials: GoogleCredentials = GoogleCredentials.getApplicationDefault()
val stackDriverTraceConfig: StackdriverTraceConfiguration = StackdriverTraceConfiguration.builder()
.setProjectId(projectId)
.setCredentials(credentials)
.build()
val exporter = StackdriverTraceExporter.createAndRegister(stackDriverTraceConfig)
exporter.ensuring(true)
Tracing.getExportComponent.getSpanExporter
val exportComponent: ExportComponent = ExportComponent.newNoopExportComponent()
exportComponent.getSpanExporter
val tracer = Tracing.getTracer
val parentSpan
=tracer.spanBuilder("rootTest").setSampler(Samplers.alwaysSample()).startSpan()
try{
val insideSpan = tracer.spanBuilderWithExplicitParent("recreatePrimaryTableSpan", parentSpan).startSpan()
try{
insideSpan.addAnnotation("testing insideSpan")} finally insideSpan.end()
}}
finally {
parentSpan.end()
exportComponent.shutdown()
}}