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

Golang: sqlcommenter or otelsql or both? #34

Open
StevenACoffman opened this issue Jul 30, 2022 · 1 comment
Open

Golang: sqlcommenter or otelsql or both? #34

StevenACoffman opened this issue Jul 30, 2022 · 1 comment

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?

@StevenACoffman
Copy link
Author

After some research, currently in Go, you need to use two different libraries to instrument the database client to have support for both regular traces and metrics and sqlcommenter.

In general, with otel telematics are exported as either traces (spans) or as metrics. Below these abstractions, you will find otel clients are exporting using technologies like Jaeger (for tracing) or Prometheus (for metrics).

This is quite different from Sqlcommenter. 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.

See XSAM/otelsql#109 and https://github.com/jbub/sqlcommenter

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

No branches or pull requests

1 participant