MystenLabs / sui

Sui, a next-generation smart contract platform with high throughput, low latency, and an asset-oriented programming model powered by the Move programming language
https://sui.io
Apache License 2.0
6.01k stars 11.11k forks source link

Distributed Tracing and Context Propagation #852

Open velvia opened 2 years ago

velvia commented 2 years ago

This is a follow-up to #620 to implement distributed tracing.

To do distributed tracing, the rough idea is that we have a master span, say one for an entire transaction execution in the gateway/client. All spans belonging to that transaction, in both client and authority, would go under that master span. To make that happen, we propagate the context from the gateway where the master span is initiated, to the authority with the transaction. Basically, the trace-id and span-id of the master span, which is auto generated.

A few things to look at:

It might be possible to generate a trace ID from the TX digest or other fields of the transaction, but I'm not sure.

Specific things:

Old issue on implementing distributed tracing in Tokio:

velvia commented 2 years ago

Specifics on trace contexts: headers vary by protocol.

gdanezis commented 2 years ago

I think that now we do all these nice things! No?

velvia commented 2 years ago

Not yet, unless @mystenmark or @bmwill added trace headers to gRPC

bmwill commented 2 years ago

No we do not do all these nice things yet, but we can now trivially add things to HTTP headers in grpc calls. So the part that's missing is actually threading through traceids and the like