Is your feature request related to a problem? Please describe.
As a developer or operator of a system using OpenTelemetry behind a REST API, the calls through the Kusto Query client library show up in App Insights (and other monitoring/telemetry tools) as pain HTTP dependency calls. Challenges:
- Hard to troubleshoot slow queries without seeing commands and seeing the query stats
- No easy way to correlate client-side logs in App Insights with service diagnostics logs in Azure Monitor
These can be implemented by each client, but many modern
Describe the solution you'd like
This work could be done inside of the Kusto client library or possibly as an add-on package in there are sufficient hooks to wire into it from the outside. (If not and an external instrumentation library is preferred, it may be necessary to add some hooks into a PR into this library).
- Create a Span for query execution calls
Enhance the Kusto Query (and possibly ingest) client using OpenTelemetry, creating a Span around the call into .execute method. On that Span add attributes like:
Query:
- query statement (opt-in due to possible data leakage into logs)
Response:
- Number of rows returned in main result set (possibly other result metadata)
- Returned query stats JSON
The Span would have the client perspective on query duration and wrap the downstream HTTP request which would still land in OpenTelemetry through instrumentation of underlying HTTP client libraries.
- Pass the OpenTelemetry trace context into the call to ADX
This would allow joining the client Span data (in App Insights, the dependency table) to ADX's Azure Monitor server-side query logs. This makes it easy to trace a client-side performance issue to the server-side perspective.
Do this by capturing the OpenTelemetry spanContext.traceId into the clientRequestProperties.clientRequestId property in .execute. (Use this as the default unless the client passes a value in for this into .execute
I haven't worked enough with the Ingest side of this library to have an opinion on how OpenTelemetry could add value there. I suggest starting with the query side for this first cut.
Describe alternatives you've considered
Currently wrapping the KustClient to add this functionality. It has been very useful in the short time we have had it.
Additional context
Prior art:
I may have a hackathon team interested in working on this and contributing it here... TBD.
Is your feature request related to a problem? Please describe.
As a developer or operator of a system using OpenTelemetry behind a REST API, the calls through the Kusto Query client library show up in App Insights (and other monitoring/telemetry tools) as pain HTTP dependency calls. Challenges:
These can be implemented by each client, but many modern
Describe the solution you'd like
This work could be done inside of the Kusto client library or possibly as an add-on package in there are sufficient hooks to wire into it from the outside. (If not and an external instrumentation library is preferred, it may be necessary to add some hooks into a PR into this library).
Enhance the Kusto Query (and possibly ingest) client using OpenTelemetry, creating a Span around the call into
.executemethod. On that Span add attributes like:Query:
Response:
The Span would have the client perspective on query duration and wrap the downstream HTTP request which would still land in OpenTelemetry through instrumentation of underlying HTTP client libraries.
This would allow joining the client Span data (in App Insights, the
dependencytable) to ADX's Azure Monitor server-side query logs. This makes it easy to trace a client-side performance issue to the server-side perspective.Do this by capturing the OpenTelemetry
spanContext.traceIdinto theclientRequestProperties.clientRequestIdproperty in.execute. (Use this as the default unless the client passes a value in for this into.executeI haven't worked enough with the Ingest side of this library to have an opinion on how OpenTelemetry could add value there. I suggest starting with the query side for this first cut.
Describe alternatives you've considered
Currently wrapping the KustClient to add this functionality. It has been very useful in the short time we have had it.
Additional context
Prior art:
I may have a hackathon team interested in working on this and contributing it here... TBD.