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

Add OpenTelemetry support from #368 #643

Merged
merged 6 commits into from
Nov 16, 2022
Merged

Add OpenTelemetry support from #368 #643

merged 6 commits into from
Nov 16, 2022

Conversation

mpilquist
Copy link
Member

andimiller and others added 6 commits June 11, 2021 15:06
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 `Resource`s 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 with with `OpenTelemetry.

The `OpenTelemetry` object which end users should interact with has these methods:
* `lift` can be used to lift any `F[T]` where `T` is an `OpenTelemetry` class with a `shutdown` method into a `Resource[F, T], it asks for a name to provide a nice error message
* `entryPoint` is the main way to make an `EntryPoint` and has a boolean flag to allow the user to globally register the `OpenTelemetry` if that's helpful, this defaults to false.
* `globalEntryPoint` will use the globally registered `OpenTelemetry` to create an `EntryPoint`

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 open-telemetry/opentelemetry-java#3306 and it was closed by this PR open-telemetry/opentelemetry-java#3307 so it should make it into the next release.
@mpilquist mpilquist merged commit bcf9bbe into main Nov 16, 2022
@mpilquist mpilquist deleted the otel branch November 16, 2022 01:53
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

Successfully merging this pull request may close these issues.

None yet

2 participants