| Copyright | Copyright 2023 Shea Levy. |
|---|---|
| License | Apache-2.0 |
| Maintainer | shea@shealevy.com |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Observe.Event.Render.OpenTelemetry
Description
Synopsis
- tracerEventBackend :: MonadIO m => Tracer -> RenderSelectorOTel s -> EventBackend m Span s
- type RenderSelectorOTel s = forall f. s f -> OTelRendered f
- data OTelRendered f = OTelRendered {}
Documentation
tracerEventBackend :: MonadIO m => Tracer -> RenderSelectorOTel s -> EventBackend m Span s Source #
An EventBackend built on a Tracer.
When no explicit parent is set, the backend will try to find a parent in the OpenTelemetry.Context.ThreadLocal Context.
However, it will never update that Context, as the primitive EventBackend API has no way to determine if it's being
consumed in a scoped context or one allowing for general interleaving.
When possible, events created with emitImmediateEvent will use the span event API. However, this requires a parent event
(explicitly specified or found in the thread-local Context), so the backend will fallback to creating and finalizeing a new
Span. If a span event is created, the resulting reference will be to its parent, as span events cannot be parents/links. Span
events do not allow for non-parent links, so any newEventCauses are dropped; in the future, we may either add them as custom
Attributes or fall back to a full span if any are specified.
Event Links are currently not given any attributes. In the future, arbitrary link metadata could be added to the core EventBackend
API, in which case we could add a renderer for the link metadata type.
Currently the backend lets the underlying Tracer set all timestamps. In the future, RenderSelectorOTel could be allowed to run in
m and have a timestamp field.
Exceptions passed to finalize are recordExceptioned without any custom attributes. In the future, an Exception -> [Text, Attribute]
argument could be added, or arbitrary exception metadata added to finalize.
type RenderSelectorOTel s = forall f. s f -> OTelRendered f Source #
Render a given selector (and all of its fields) to OpenTelemetry
data OTelRendered f Source #
The result of rendering a specific selector with field type f
Constructors
| OTelRendered | |
Fields
| |