dapr
dapr copied to clipboard
Dapr replaces existing CloudEvent trace with autogenerated trace
Expected Behavior
I expect that it's possible to specify the desired traceid
and traceparent
values, using the pulish_event
method with data_content_type="application/cloudevents+json"
.
Actual Behavior
Some Dapr CloudEvent fields can be specify (ex. source
and type
) as expected from documentation. But other fields are ignored (ex. traceid
, traceparent
).
Steps to Reproduce the Problem
dapr version: dapr==1.12.1
The following code:
MY_DATA = {
"source":"MY_SOURCE",
"type":"MY_TYPE",
"data": {
"x": 1,
"y": 2
},
"traceid":"00-20fb8e95782a3548a903dd43c83396b4-c39ddb6ef445b8e3-01",
"traceparent":"00-20fb8e95782a3548a903dd43c83396b4-c39ddb6ef445b8e3-01",
}
dapr_client.publish_event(
pubsub_name=MY_PUBSUB_NAME,
topic_name=MY_TOPIC_NAME,
data=json.dumps(MY_DATA),
data_content_type="application/cloudevents+json",
)
produces this message:
{
"data": {
"x": 1,
"y": 2
},
"pubsubname": "kafka-pubsub",
"source": "MY_SOURCE",
"specversion": "1.0",
"time": "2024-01-23T14:04:23Z",
"topic": "test",
"traceid": "00-d258f97bef8a57285dd19490337d4b35-a179d57fa4846794-01",
"traceparent": "00-d258f97bef8a57285dd19490337d4b35-a179d57fa4846794-01",
"tracestate": "",
"type": "MY_TYPE"
}
instead of the desired traceid
and traceparent
value (00-20fb8e95782a3548a903dd43c83396b4-c39ddb6ef445b8e3-01
).
Moving this to Dapr Runtime because this is not Python specific. It occurs at the runtime level.
When tracing information is not attached to the gRPC request itself and only resides in the raw cloud event Dapr generates a new trace and replaces this in the cloud event.
Dapr should not override these values if they are already set.
@berndverst In the Python SDK then, how can a user pass the traceid and traceparent?
Interested to see if there are any pointers here. I am interested in this from a .NET perspective too. I have no means of setting the traceparent when publishing an event but would like to be able to do so. I am trying to get distributed tracing working in Kibana but it doesn't work because Kibana is using the {SpanID}
portion of the trace to build the complete picture.
It would be nice if Dapr acknowledging any traceparent
or traceId
metadata fields when publishing through the Dapr client and only if nothing is provided for those values, derive it's own.
This issue has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 67 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue, help wanted or triaged/resolved. Thank you for your contributions.
Should this be reopened?