Enable the ZIO OpenTelemetry example now that tapir-zio-opentelemetry is released#5329
Conversation
… is released Renamed ZIOpenTelemetryExample from .skip to .scala and bumped its scala-cli `//> using` deps to the released versions (tapir 1.13.22, zio-opentelemetry 3.1.17, opentelemetry 1.63.0). Verified with `scala-cli compile` against Maven Central - the example compiles cleanly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| object ZIOpenTelemetryExample extends ZIOAppDefault: | ||
|
|
||
| /** The OpenTelemetry SDK, autoconfigured from `OTEL_*` env variables, closed when the app shuts down. */ | ||
| private val openTelemetryLayer: ZLayer[Any, Throwable, OpenTelemetry] = |
There was a problem hiding this comment.
This is really compact, setup but AFAIU, ZIO.logging ZIO runtime metrics, to be collected via OTLP must rely on bootstrap layer. Hence, it can be more tricky, and that was the (missed) intention of the tapir-zio-opentelemetry-bootstrap.
There was a problem hiding this comment.
Aren't logging/metrics independent layers? It should be a matter of changing the layer-construction at startup, no?
There was a problem hiding this comment.
Yes they are, the point is that AFAU, they must be defined early at bootstrap, if you provide them "just" at startup, it compiles and run the behaviour is weird (in particular for the zioMetrics ).
BTW this is documented for ZIO Logging https://github.com/zio/zio-logging#example, not that explicitly for zio runtime metrics.
There was a problem hiding this comment.
Ah ok. Maybe we could have an additional example which configures this properly? I don't think it would be the responsibility of a tapir module to provide proper ZIO bootstrap, though
There was a problem hiding this comment.
I was my second attempt but I fail to do this in clean way (different files) and scala-cli, that why I put this in a specific module. To keep the sample simple.
But ya I fully agree that this should not be part of tapir as it pulls to many dependencies.
Will try again.
Thanks a lot for review, commits and kindness.
Follow-up to #5256: now that
tapir-zio-opentelemetryis published (1.13.22), the example can be compiled.ZIOpenTelemetryExamplefrom.skipto.scalaso it's part of the build and the scala-cli verification.//> usingdeps to the released versions: tapir1.13.22, zio-opentelemetry3.1.17, opentelemetry1.63.0.Verified locally with
scala-cli compile(the same command theverifyExamplesCompileUsingScalaCliCI step runs) — it resolves the 1.13.22 artifacts from Maven Central and compiles cleanly (Scala 3.8.3).🤖 Generated with Claude Code