Skip to content

Enable passing OTEL trace context to client's query methods #303

Description

@martijnthe

Is your feature request related to a problem? Please describe.

As per the ClickHouse docs:

ClickHouse accepts trace context HTTP headers, as described by the W3C recommendation.

At the moment, there is no clean way to pass Open Telemetry trace context when calling a client's query methods.
I realize the feature is "experimental", but the format of the header and OTEL itself can be deemed as stable. Therefore it's unlikely to change at the client layer and probably fine to already implement (but of course up to the maintainers to decide).

Describe the solution you'd like

I'd like to be able to pass a trace_context: TraceContext query arg to each of the query methods, which would set the trace context headers/metadata when making the request to the server.

The TraceContext object would contain a subset of the fields from OTEL's SpanContext -- only the fields that need to be included in the header.

Describe alternatives you've considered

One can implement this functionality by subclassing the client class of course, but it would be nice if it's built-in.

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions