Skip to content

Commit 7d46cfa

Browse files
committed
chore: Propagate traceparent to workflow activity
Signed-off-by: Javier Aliaga <[email protected]>
1 parent d623475 commit 7d46cfa

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

durabletask-client/pom.xml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,32 +121,24 @@
121121
</executions>
122122
</plugin>
123123
<plugin>
124-
<groupId>io.github.ascopes</groupId>
124+
<groupId>org.xolstice.maven.plugins</groupId>
125125
<artifactId>protobuf-maven-plugin</artifactId>
126126
<version>${protobuf-maven-plugin.version}</version>
127127
<configuration>
128-
<protocVersion>${protobuf.version}</protocVersion>
129-
<embedSourcesInClassOutputs>true</embedSourcesInClassOutputs>
130-
<sourceDirectories>
131-
<sourceDirectory>${protobuf.input.directory}</sourceDirectory>
132-
</sourceDirectories>
133-
<binaryMavenPlugins>
134-
<binaryMavenPlugin>
135-
<groupId>io.grpc</groupId>
136-
<artifactId>protoc-gen-grpc-java</artifactId>
137-
<version>${grpc.version}</version>
138-
</binaryMavenPlugin>
139-
</binaryMavenPlugins>
128+
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
129+
<pluginId>grpc-java</pluginId>
130+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
131+
<protoSourceRoot>${protobuf.input.directory}</protoSourceRoot>
140132
</configuration>
141133
<executions>
142134
<execution>
143135
<goals>
144-
<goal>generate</goal>
136+
<goal>compile</goal>
137+
<goal>compile-custom</goal>
145138
</goals>
146139
</execution>
147140
</executions>
148141
</plugin>
149-
150142
<plugin>
151143
<groupId>org.apache.maven.plugins</groupId>
152144
<artifactId>maven-source-plugin</artifactId>

durabletask-client/src/main/java/io/dapr/durabletask/DurableTaskGrpcClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import io.grpc.netty.GrpcSslContexts;
3030
import io.grpc.netty.NettyChannelBuilder;
3131
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
32-
import io.opentelemetry.api.OpenTelemetry;
32+
import io.opentelemetry.api.GlobalOpenTelemetry;
3333
import io.opentelemetry.api.trace.Span;
3434
import io.opentelemetry.api.trace.Tracer;
3535

@@ -140,7 +140,8 @@ public final class DurableTaskGrpcClient extends DurableTaskClient {
140140
if (builder.tracer != null) {
141141
this.tracer = builder.tracer;
142142
} else {
143-
this.tracer = OpenTelemetry.noop().getTracer("DurableTaskGrpcClient");
143+
//this.tracer = OpenTelemetry.noop().getTracer("DurableTaskGrpcClient");
144+
this.tracer = GlobalOpenTelemetry.getTracer("dapr-workflow");
144145
}
145146

146147
this.sidecarClient = TaskHubSidecarServiceGrpc.newBlockingStub(sidecarGrpcChannel);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package io.dapr.durabletask.util;
2+
3+
public class TraceUtils {
4+
5+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1717
<grpc.version>1.69.0</grpc.version>
1818
<protobuf.version>3.25.5</protobuf.version>
19-
<dapr.proto.baseurl>https://raw.githubusercontent.com/dapr/dapr/master/dapr/proto</dapr.proto.baseurl>
19+
<dapr.proto.baseurl>https://raw.githubusercontent.com/dapr/dapr/v1.16.0-rc.5/dapr/proto</dapr.proto.baseurl>
2020
<durabletask.proto.url>https://raw.githubusercontent.com/dapr/durabletask-protobuf/main/protos/orchestrator_service.proto</durabletask.proto.url>
2121
<dapr.sdk.version>1.17.0-SNAPSHOT</dapr.sdk.version>
2222
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>

sdk-workflows/src/main/java/io/dapr/workflows/WorkflowActivityContext.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ public interface WorkflowActivityContext {
2525

2626
<T> T getInput(Class<T> targetType);
2727

28+
String getTraceParent();
2829
}

sdk-workflows/src/main/java/io/dapr/workflows/runtime/DefaultWorkflowActivityContext.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ public <T> T getInput(Class<T> targetType) {
9797
return this.innerContext.getInput(targetType);
9898
}
9999

100+
@Override
101+
public String getTraceParent() {
102+
return this.innerContext.getTraceParent();
103+
}
104+
100105
@Override
101106
public String getTaskExecutionId() {
102107
return this.innerContext.getTaskExecutionId();

0 commit comments

Comments
 (0)