Repository navigation
Opentelemetry - #1963
Merged
Merged
Opentelemetry#1963
Conversation
dragoslav
marked this pull request as ready for review
November 5, 2026 08:53
Tim-Linschoten
approved these changes
Nov 5, 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenTelemetry tracing
The in-memory runtime emits spans using OpenTelemetry when built through
InMemoryBaker.What is traced
baker.buildbaker.recipe-instance.createdbaker.event.received,baker.event.firedbaker.interaction.<interactionName>Interaction spans are created as children of the latest event span for the same recipe instance.
Ambient context inside interactions
The interaction span is started on the very thread that invokes your interaction implementation, so
Span.current()and the SLF4JMDCare valid and belong to that invocation, also under heavy concurrency:Baker runs interactions on a shared pool. Before and after every invocation the registered context propagators are
cleared, so a pooled thread can never expose the context of a previous execution. If your interaction spawns its own
threads, propagate the context explicitly (for example with
Context.current().wrap(runnable)).For a
CompletableFuture-returning interaction the span is ended when the future completes; for a blockinginteraction it is ended when the method returns.
Common attributes
baker.recipe.idbaker.recipe.namebaker.recipe.instance.idDepending on the span type, additional attributes are set:
baker.event.namebaker.interaction.namebaker.correlation.idbaker.failure.counterror.type(for failed interactions)Injecting a custom tracer
By default, Baker uses
GlobalOpenTelemetry.getTracer(...). You can provide your own tracer:For async Java factory usage:
Where the OpenTelemetry code lives
The OpenTelemetry-specific code is isolated in the
baker-interface-otelmodule:OpenTelemetryContextPropagator— propagates the OTelContextto Baker's interaction pool. It is discoveredautomatically through
META-INF/services, so simply having the module on the classpath is enough.OpenTelemetryInteractionInstrumentation— starts, scopes and ends thebaker.interaction.<name>span.RecipeInstanceTraceContexts— per-baker mapping of recipe instance to the context the interaction span is parented to.baker-interfaceitself stays free of OpenTelemetry. It only exposes the SPIscom.ing.baker.runtime.model.propagation.ExecutionContextPropagator(propagate any thread-bound context) andcom.ing.baker.runtime.model.InteractionInstrumentation(wrap every interaction invocation), which you can implementto plug in a different tracing or diagnostics stack.