SQLx-Datadog
This crate provides a drop-in replacement for tracing::instrument
meant for
instrumenting SQLx queries with
tracing for use with
tracing-opentelemetry.
It automatically injects span tags for Datadog to correctly identify the span as a SQL query and set relevant attributes.
This is what it looks like in action:
use Execute;
use instrument_query;
async
Current Limitations
For the time being, it still requires manually setting the query text as shown in the example, and it does not inject the distributed tracing comment into the query yet.
It probably does not work with SQLite, as SQLite's ConnectOptions
are
quite different from both MySQL's and Postgres'.