Error propagating cutom trace-id on pub/sub
- Dominant language
- Java
- Stars
- 300
- Forks
- 230
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 4
Description
## Expected Behavior
Dapr runtime: 1.15.5
Dapr Cli: 1.15.0
Java SDK: 1.13.3
I'm expecting to see the same trace-id for my publisher and subscriber on zipkin when I set a custom trace-id as a metadata when I call PublishEvent. Ie:
Sample code:
```java
// Create order data
Map order = new HashMap<>();
String orderId = UUID.randomUUID().toString();
order.put("orderId", orderId);
order.put("customer", "test-customer");
order.put("amount", 100.00);
order.put("timestamp", System.currentTimeMillis());
// Create metadata to override CloudEvent properties
Map metadata = new HashMap<>();
metadata.put("cloudevent.traceid", "your-custom-trace-id");
metadata.put("cloudevent.source", "order-service");
metadata.put("cloudevent.type", "com.example.order");
metadata.put("cloudevent.id", UUID.randomUUID().toString());
// Publish with metadata
return daprClient.publishEvent(
PUBSUB_NAME,
TOPIC_NAME,
order,
metadata
).then(Mono.fromCallable(() -> {
String response = "Published order with ID: " + orderId;
logger.info(response);
return response;
}));
```
## Actual Behavior
Following the example above, Zipkin shows 2 different entries for the publisher and subscriber.each with its own trace-id:
## Steps to Reproduce the Problem
Run the sample here: https://github.com/rochabr/dapr-trace-example
Contributor guide
Assessment
This issue has not been assessed yet.