Documentation
¶
Overview ¶
Package otel turns the engine's event stream into OpenTelemetry traces: one trace per run, a span per node and per hook step, and the request attempts as span events. Traces leave as OTLP over HTTP with a JSON body, which every collector accepts; no SDK is involved.
It is off unless Config.Endpoint is set. The Exporter is wired in through engine.Deps.Observe and engine.Deps.Traceparent and never affects a run: Observe does not block, and export failures are logged and reported by Close, nothing more.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Endpoint string
Headers map[string]string // sent with every export (typically a token)
Propagate bool // add traceparent to outgoing requests
Service string // service.name; default "flowi"
Version string // service.version
Timeout time.Duration // per export; default 10s
QueueSize int // finished traces waiting to be sent; default 64
Now func() time.Time // nil → time.Now
Client *http.Client // nil → a client with Timeout
}
Config configures an Exporter. Endpoint is the collector's base URL ("http://localhost:4318"); "/v1/traces" is appended unless it is there.
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter builds traces from engine events and sends them to a collector.
Goroutine ownership: New starts one worker that posts queued traces; Close stops accepting traces, lets the worker finish what is queued (or gives up when its context ends) and waits for it. Observe and Traceparent are safe for concurrent use; Observe never blocks.
func New ¶
New starts an exporter. An empty or malformed endpoint is an error: callers create an Exporter only when OTEL is switched on.
func (*Exporter) Close ¶
Close sends what is queued and stops the worker. It returns the export errors seen so far, or ctx's error when the flush did not finish in time. Traces of runs still open are discarded.
func (*Exporter) Dropped ¶
Dropped is the number of traces discarded because the queue was full or too many runs were open.
func (*Exporter) Observe ¶
Observe folds one engine event into its run's trace and queues the trace when the run ends. It matches engine.Deps.Observe.
func (*Exporter) Traceparent ¶
Traceparent is the header value naming the span of the call made by node path ("" for a standalone send) of run runID, or "" when propagation is off. It matches engine.Deps.Traceparent.