telemetry

package module
v0.0.0-...-0c063f8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

@sk-task production-features#T3.3: implement OTEL bridge (AC-006, AC-007)

Package telemetry provides OpenTelemetry span and metric recording for crew execution. Import this package to enable OTEL instrumentation:

import "github.com/bzdvdn/draftcrew/telemetry"

bridge := telemetry.NewOTELBridge(nil, nil)
bridge.Attach(crew)
http.Handle("/metrics", bridge.MetricsHandler())

@sk-task event-bus#T3.2: OTELBridge with span creation (AC-010)

@sk-task otel-metrics#T2.1: define instruments struct (AC-001–006)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBusBridge

type EventBusBridge struct {
	// contains filtered or unexported fields
}

EventBusBridge subscribes to the event bus and creates OpenTelemetry spans.

func NewEventBusBridge

func NewEventBusBridge(bus *events.EventBus, tp trace.TracerProvider) *EventBusBridge

NewEventBusBridge creates an EventBusBridge that creates spans for each bus event.

func (*EventBusBridge) Attach

func (b *EventBusBridge) Attach()

Attach subscribes to the event bus and starts creating spans.

type OTELBridge

type OTELBridge struct {
	// contains filtered or unexported fields
}

OTELBridge provides OpenTelemetry span and metric recording for crew execution.

func NewOTELBridge

func NewOTELBridge(tracerProvider trace.TracerProvider, _ metric.MeterProvider) *OTELBridge

NewOTELBridge creates a new OTELBridge. If tracerProvider is nil, only metrics are active. When OTEL_METRICS_ENABLED != "false", an internal Prometheus meter provider is created and metric instruments are registered. MetricsHandler() returns the HTTP handler.

func (*OTELBridge) Attach

func (b *OTELBridge) Attach(c *crew.Crew)

Attach subscribes to the crew's StepCallback and creates OTEL spans.

func (*OTELBridge) MetricsHandler

func (b *OTELBridge) MetricsHandler() http.Handler

MetricsHandler returns an http.Handler that serves Prometheus metrics at /metrics. Returns a no-op handler when metrics are disabled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL