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 an opentelemetry module #368

Merged
merged 369 commits into from
Nov 16, 2022

Conversation

andimiller
Copy link
Contributor

@andimiller andimiller commented Jun 11, 2021

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:

  • 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.

@andimiller
Copy link
Contributor Author

I can also port this over to the 0.1 branch pretty easily, we just needed it for 0.0

@zmccoy
Copy link
Member

zmccoy commented Nov 18, 2021

I was just looking for this today!

scala-steward and others added 28 commits December 6, 2021 13:05
…-static-2.0.46.Final' into topic/update-bundle

# Conflicts:
#	build.sbt
…topic/update-bundle

# Conflicts:
#	build.sbt
mpilquist and others added 24 commits October 1, 2022 18:06
Update Kernel.scala - cleanup documentation
Setting appropriate error flags and logs in JaegerSpan
Add utilities for converting Kleisli[F, Span[F], A] to F[A]
Co-authored-by: Arman Bilge <armanbilge@gmail.com>
@mpilquist
Copy link
Member

I merged #539. Please take a look and see if there's anything from this PR we should incorporate.

@mpilquist mpilquist merged commit 7621ee5 into typelevel:series/0.0 Nov 16, 2022
mpilquist added a commit that referenced this pull request Nov 16, 2022
Add OpenTelemetry support from #368
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.