Add an `opentelemetry` module
This adds a natchez-opentelemetry module which allows span reporting via the opentelemetry-java project.
The Utils object contains a helper to turn the OpenTelemetry CompletableResultCode class into an F[Unit] given Async[F], this is useful for implementing Resources for clean shutdown logic.
Shutdownable is a little abstraction to unify all the interfaces that have a shutdown(): CompletableResultCode method in OpenTelemetry, since they have no common interface.
OpenTelemetrySpan and OpenTelemetryEntryPoint are heavily based on the natchez-jaeger versions, with tweaks to make them work with OpenTelemetry.
The OpenTelemetry object which end users should interact with has these methods:
-
liftcan be used to lift anyF[T]whereTis anOpenTelemetryclass with ashutdownmethod into aResource[F, T], it asks for a name to provide a nice error message -
entryPointis the main way to make anEntryPointand has a boolean flag to allow the user to globally register theOpenTelemetryif that's helpful, this defaults to false. -
globalEntryPointwill use the globally registeredOpenTelemetryto create anEntryPoint
Note that this is currently using OpenTelemetry libraries at 1.4.0-SNAPSHOT because I found a bug while developing this this broke the shutdown logic.
The issue is here https://github.com/open-telemetry/opentelemetry-java/issues/3306 and it was closed by this PR https://github.com/open-telemetry/opentelemetry-java/pull/3307 so it should make it into the next release.
I can also port this over to the 0.1 branch pretty easily, we just needed it for 0.0
I was just looking for this today!
Can we expect this to be merged any time soon? It would be great!
I merged #539. Please take a look and see if there's anything from this PR we should incorporate.