Skip to content

Enable the ZIO OpenTelemetry example now that tapir-zio-opentelemetry is released#5329

Merged
adamw merged 1 commit into
masterfrom
unskip-zio-opentelemetry-example
Jun 17, 2026
Merged

Enable the ZIO OpenTelemetry example now that tapir-zio-opentelemetry is released#5329
adamw merged 1 commit into
masterfrom
unskip-zio-opentelemetry-example

Conversation

@adamw

@adamw adamw commented Jun 17, 2026

Copy link
Copy Markdown
Member

Follow-up to #5256: now that tapir-zio-opentelemetry is published (1.13.22), the example can be compiled.

  • Renamed ZIOpenTelemetryExample from .skip to .scala so it's part of the build and the scala-cli verification.
  • Bumped its //> using deps to the released versions: tapir 1.13.22, zio-opentelemetry 3.1.17, opentelemetry 1.63.0.

Verified locally with scala-cli compile (the same command the verifyExamplesCompileUsingScalaCli CI step runs) — it resolves the 1.13.22 artifacts from Maven Central and compiles cleanly (Scala 3.8.3).

🤖 Generated with Claude Code

… 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>
@adamw adamw merged commit 8ddef64 into master Jun 17, 2026
37 of 38 checks passed
@adamw adamw deleted the unskip-zio-opentelemetry-example branch June 17, 2026 12:34
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] =

@onouguier-ledger onouguier-ledger Jun 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't logging/metrics independent layers? It should be a matter of changing the layer-construction at startup, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

3 participants