A while back, OTEL merged SqlCommenter (seeSqlCommenter merged into OpenTelemetry).
SqlCommenter works on the driver/ORM layer, by injecting metadata containing comments as part of the SQL statements sent to the database. These logs are then ingested on the database side (with support from Cloud SQL Insights, a proprietary Google Cloud offering). I am not aware of OSS solutions that do this ingestion and expose this data to the user yet, but I'm sure with this becoming part of otel we will begin seeing something like that.
I would like otelpgx to add the de facto standardized fields traceparent and tracestate to the SQL as comments sent to the database. For example:
select * from widgets /*traceparent='00-5bd66ef5095369c7b0d1f8f4bd33716a-c532cb4098ac3dd2-01',tracestate='congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7'*/
I want to be able to use both Cloud SQL Insights and Cloud Trace in my application, and I think otelpgx could do it for me.
Currently, XSAM/otelsql offers this as an experimental feature.
WithSQLCommenter will enable or disable context propagation for the database by injecting a comment into SQL statements.
e.g., a SQL query:
will become
SELECT * from FOO /*traceparent='00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01',tracestate='congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7'*/
A while back, OTEL merged SqlCommenter (seeSqlCommenter merged into OpenTelemetry).
SqlCommenter works on the driver/ORM layer, by injecting metadata containing comments as part of the SQL statements sent to the database. These logs are then ingested on the database side (with support from Cloud SQL Insights, a proprietary Google Cloud offering). I am not aware of OSS solutions that do this ingestion and expose this data to the user yet, but I'm sure with this becoming part of
otelwe will begin seeing something like that.I would like otelpgx to add the de facto standardized fields
traceparentandtracestateto the SQL as comments sent to the database. For example:I want to be able to use both Cloud SQL Insights and Cloud Trace in my application, and I think otelpgx could do it for me.
Currently, XSAM/otelsql offers this as an experimental feature.
WithSQLCommenterwill enable or disable context propagation for the database by injecting a comment into SQL statements.e.g., a SQL query:
will become