Tracing: Incoming TraceId is lost and outgoing is either completely lost or rounded
Related to #3011, https://github.com/hasura/graphql-engine/pull/5517
Versions
graphql-engine v1.3.3 and v1.3.4-beta.2 postgres v11.6.0
Environment
minikube / kubernetes
Steps to Reproduce
- create a table
- set up an event trigger for the table
- run a mutation using tracing headers
X-Hasura-TraceId&X-B3-TraceId
Expected Result
- Incoming tracing headers use B3 compliant names
- TraceID is preserved
Actual Result in v1.3.3
- Incoming tracing headers use custom X-Hasura-* names
- TraceID is lost in (rounded due to JSON conversion and JS number overflow?)
Event invocation log in v1.3.3
Notice the missing 1 from the end of trace_id and the trailing zeros in span_id.
{
"payload": {
"event": {
"session_variables": {
"x-hasura-spanid": "1000000000000000001",
"x-hasura-role": "admin",
"x-hasura-traceid": "1000000000000000001"
},
"op": "INSERT",
"data": { ... },
"trace_context": {
"trace_id": 1000000000000000000,
"span_id": 4083814875249555000
}
},
"created_at": "2021-01-20T06:36:53.940866Z",
"id": "4317f03c-d81a-4d6c-bf83-ede895fbb0d9",
"delivery_info": {
"max_retries": 0,
"current_retry": 0
},
"trigger": {
"name": "changelog"
},
"table": {
"schema": "audit",
"name": "logged_actions"
}
},
"headers": [
{
"value": "application/json",
"name": "Content-Type"
},
{
"value": "hasura-graphql-engine/v1.3.3",
"name": "User-Agent"
}
],
"version": "2"
}
Actual Result in v1.3.4-beta.2
- Incoming tracing headers use custom X-Hasura-* names
- TraceID is lost in (new TraceId is generated AND rounded due to JSON conversion and JS number overflow?)
Event invocation log in v1.3.4-beta.2
Notice the 3 trailing zeros in trace_id and span_id
{
"payload": {
"event": {
"session_variables": {
"x-hasura-spanid": "1000000000000000001",
"x-hasura-role": "admin",
"x-hasura-traceid": "1000000000000000001"
},
"op": "INSERT",
"data": { ... },
"trace_context": {
"trace_id": 14323783848538888000,
"span_id": 8736764150515762000
}
},
"created_at": "2021-01-20T07:02:31.457988Z",
"id": "8aeb9ff5-54de-4b76-aea6-cbf1acb4cef7",
"delivery_info": {
"max_retries": 0,
"current_retry": 0
},
"trigger": {
"name": "changelog"
},
"table": {
"schema": "audit",
"name": "logged_actions"
}
},
"headers": [
{
"value": "application/json",
"name": "Content-Type"
},
{
"value": "hasura-graphql-engine/v1.3.4-beta.2",
"name": "User-Agent"
}
],
"version": "2"
}
@richteri Thank you for reporting the issue. I'm looking into it now and will get back to you with an update :)
Closing the issue since it has been fixed in https://github.com/hasura/graphql-engine-mono/pull/446.
@Naveenaidu, Any chance it'll make its way into the current repo / CE release soon?
@richteri This will be released from 2.0.0-alpha.8 onwards :)
It's already in the current repo(hasura/graphql engine) in this commit https://github.com/hasura/graphql-engine/commit/f6fbf20b801c008ca5c60a9420de7b092863517d in case you wanna try it out ^^