GreptimeTeam / greptimedb

An open-source, cloud-native, unified time series database for metrics, logs and events with SQL/PromQL supported. Available on GreptimeCloud.
https://greptime.com/
Apache License 2.0
4.33k stars 313 forks source link

pass down tracing context for region requests #4670

Open lyang24 opened 2 months ago

lyang24 commented 2 months ago

What type of enhancement is this?

API improvement

What does the enhancement do?

Mito Engine spawns regional worker to handle request in another thread with a loop. The trace span is not continuous with current impl.

The goal of this issues is to pass down ctx with requests defined in src/store-api/src/region_request.rs so tracing spans are continious.

examples of fragmented spans: This is the main span with write requests image Ideally when we adding more tracing to the write path on mito engine level the spans should be attached the above trace. Today the new spans are separated from main trace.

image

Implementation challenges

No response

killme2008 commented 2 months ago

@evenyag LGTM. What do you think?

evenyag commented 2 months ago

Adding this to the request should be helpful for troubleshooting. We can add a header struct to the request like our gRPC request. https://github.com/GreptimeTeam/greptime-proto/blob/c437b55725b7f5224fe9d46db21072b4a682ee4b/proto/greptime/v1/common.proto#L31-L45

The region request header mainly contains the tracing context.