Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: sqlcommenter support? #109

Closed
StevenACoffman opened this issue Jul 30, 2022 · 5 comments · Fixed by #112
Closed

Feature Request: sqlcommenter support? #109

StevenACoffman opened this issue Jul 30, 2022 · 5 comments · Fixed by #112
Labels
enhancement New feature or request

Comments

@StevenACoffman
Copy link

I read that Sqlcommenter merged into OpenTelemetry.

I have database connection code that I have already instrumented with https://github.com/XSAM/otelsql

	wrappedDriverName, err := otelsql.Register(
		"pgx",
		semconv.DBSystemPostgreSQL.Value.AsString(),
	)

and I am wondering if adding sqlcomment is redundant or if it would provide additional value?

@XSAM
Copy link
Owner

XSAM commented Jul 31, 2022

I am not familiar with the sqlcomment, but as long as it instruments the database via injecting codes into database/sql, which it is, they are pretty much doing the same thing.

@StevenACoffman
Copy link
Author

StevenACoffman commented Aug 3, 2022

Sqlcommenter works on the driver/ORM layer, by injecting metadata containing comments as part of the SQL statements that are 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 otelsql driver 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'd like to be able to use both Cloud SQL Insights and Cloud Trace in my application, and I think XSAM/otelsql could do it for me.

@XSAM
Copy link
Owner

XSAM commented Aug 10, 2022

@StevenACoffman This is an interesting feature 👍. I created a PR to implement this. PTAL.

@XSAM XSAM closed this as completed in #112 Aug 25, 2022
@StevenACoffman
Copy link
Author

Thanks! Very cool!

@XSAM
Copy link
Owner

XSAM commented Aug 25, 2022

@StevenACoffman I just released this feature. Enjoy! I am happy to hear feedback on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants