Created
April 27, 2026 14:28
-
-
Save kubukoz/f849057d6df6d25919f3733427b9511e to your computer and use it in GitHub Desktop.
otel4s full JVM metrics 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/build.sbt b/build.sbt | |
| index a34d516..7ed900b 100644 | |
| --- a/build.sbt | |
| +++ b/build.sbt | |
| @@ -71,7 +71,6 @@ lazy val app = | |
| // "org.typelevel" %% "otel4s-experimental-metrics" % "0.5.0", | |
| "org.http4s" %% "http4s-otel4s-middleware-trace-client" % "0.18.0-RC1", | |
| "org.http4s" %% "http4s-otel4s-middleware-trace-server" % "0.18.0-RC1", | |
| - "io.opentelemetry.instrumentation" % "opentelemetry-runtime-telemetry" % "2.27.0-alpha", | |
| // | |
| // AWS | |
| // | |
| @@ -89,6 +88,8 @@ lazy val app = | |
| javaOptions += "-Dotel.exporter.otlp.endpoint=https://api.eu1.honeycomb.io", | |
| javaOptions += "-Dotel.logs.exporter=otlp", | |
| javaOptions += "-Dotel.bsp.schedule.delay=1000", | |
| + javaOptions += "-Dotel.instrumentation.runtime-telemetry.emit-experimental-metrics=true", | |
| + javaOptions += "-Dotel.instrumentation.runtime-telemetry.emit-experimental-jfr-metrics=true", | |
| javaAgents += "io.github.irevive" % "otel4s-opentelemetry-javaagent" % "2.27.0" % Runtime, | |
| Universal / javaOptions ++= javaOptions.value, | |
| Compile / run / fork := true, | |
| diff --git a/modules/app/src/main/scala/wypo/Main.scala b/modules/app/src/main/scala/wypo/Main.scala | |
| index 726ac7f..d1afc58 100644 | |
| --- a/modules/app/src/main/scala/wypo/Main.scala | |
| +++ b/modules/app/src/main/scala/wypo/Main.scala | |
| @@ -3,8 +3,6 @@ package wypo | |
| import cats.effect.* | |
| import cats.syntax.all.* | |
| import doobie.util.transactor.Transactor | |
| -import io.opentelemetry.api.OpenTelemetry as JOpenTelemetry | |
| -import io.opentelemetry.instrumentation.runtimetelemetry.* | |
| import org.http4s.* | |
| import org.http4s.ember.server.* | |
| import org.http4s.implicits.* | |
| @@ -39,7 +37,6 @@ object Main extends IOApp.Simple { | |
| logger @ given Logger[IO] = Slf4jLogger.getLoggerFromName[IO]("wypo.backend") | |
| given LocalProvider[IO, Context] = IOLocalContextStorage.localProvider[IO] | |
| otel <- OtelJava.global[IO].toResource | |
| - _ <- registerRuntimeTelemetry(otel.underlying) | |
| given TracerProvider[IO] = otel.tracerProvider | |
| given Tracer[IO] <- otel.tracerProvider.get("wypo.backend").toResource | |
| @@ -149,12 +146,4 @@ object Main extends IOApp.Simple { | |
| mkServer.tracedAcquire("server.start") | |
| }.useForever | |
| - private def registerRuntimeTelemetry( | |
| - openTelemetry: JOpenTelemetry | |
| - ): Resource[IO, Unit] = { | |
| - val acquire = IO(RuntimeTelemetry.create(openTelemetry)) | |
| - | |
| - Resource.fromAutoCloseable(acquire).void | |
| - } | |
| - | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment