-
-
Notifications
You must be signed in to change notification settings - Fork 166
Use OpenTelemetry Semantic Conventions #1255
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
base: main
Are you sure you want to change the base?
Conversation
76cf10c to
b1e5558
Compare
1fb5ce0 to
c52e9fb
Compare
| object Otel { | ||
|
|
||
| // TODO the current snapshot used does not have the new `From` instance, | ||
| // and I cannot update the otel4s dependency since skunk depends on SN 0.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still true with the snapshot we just upgraded to last week?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased on main yesterday and it was still the case. Maybe we need another snapshot @iRevive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are updated snapshots:
lazy val otel4sVersion = "0.16-83b6f7b-SNAPSHOT"
lazy val otel4sSdkVersion = "0.17-c767f1d-SNAPSHOT"|
|
||
| trait FTest extends CatsEffectSuite with FTestPlatform { | ||
|
|
||
| implicit val meter: Meter[IO] = Meter.noop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we tie this in with the other test machinery (withinSpan, tracedTest, etc)
| * @param parseCacheSize size of the pool-level cache for parsing statements; defaults to 2048 | ||
| */ | ||
| final class Builder[F[_]: Temporal: Network: Console] private ( | ||
| final class Builder[F[_]: Temporal: Meter: Network: Console] private ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious if we should just take a Tracer here too and drop support for explicitly passing a Tracer? Or alternatively, should we support explicitly passing a Meter using a similar pattern? Explicit passing was added back when tracing was done via Natchez: #650
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the implicit Tracer is the more idiomatic way of doing it in otel4s. This could be done in a follow-up PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep for sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to use MeterProvider so you can explicitly define and control the instrumentation scope. Then, you can create a Meter inside the pooled / single:
val meter: F[Meter] = MeterProvider[F].tracer("skunk").withVersion(BuildInfo.version).getOpenTelemetry generally recommends that libraries own their instrumentation scopes.
We follow a similar approach in http4s-otel4s-middleware or fs2-grpc-otel4s.
If possible, I would do the same with Tracer.
If users don't need tracing or metering capabilities, they can use given MeterProvider[F] = MeterProvider.noop.
This is an attempt at #1127 and an opportunity to align the existing traces with the ones defined in semantic conventions.
The current PR:
PostgresErrorExceptionThere currently are some limitations with this implementation:
queryorexecute)db.client.response.returned_rowsor connection pool metrics are not added)Histogramhas to be propagated, I think it is not an issue, correct me if I'm wrong.