otel

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const RedactedAttributeValue = "<redacted>"

RedactedAttributeValue is the placeholder substituted for sensitive span-attribute values before export. Mirrors the slogging convention.

Variables

This section is empty.

Functions

func RegisterPoolMetrics

func RegisterPoolMetrics(dbStatsFn func() DBPoolStats, redisStatsFn func() RedisPoolStats) error

RegisterPoolMetrics registers observable gauges for DB and Redis pool monitoring. Either dbStatsFn or redisStatsFn may be nil to skip registration for that pool. SEM@82a346411b061b20ff839bbbd4281294e94d82ff: register OTel observable gauges for DB and Redis pool stats (mutates shared state)

func Setup

func Setup(ctx context.Context, cfg Config) (shutdown func(context.Context) error, err error)

Setup initializes OpenTelemetry trace and metric providers. Returns a shutdown function that must be called on server stop. When cfg.Enabled is false, registers no-op providers (zero overhead). SEM@ad7cd6a870c6ca3d54d847943b47256a0b5325f2: initialize OTel trace and metric providers and return a shutdown function (mutates shared state)

Types

type Config

type Config struct {
	Enabled        bool
	SamplingRate   float64
	PrometheusPort int
}

Config holds TMI-side OpenTelemetry configuration. SEM@03edeb4bda4d0f23d973e17c1a0fe428dda94538: configuration struct for OpenTelemetry tracing and metrics setup (pure)

type DBPoolStats

type DBPoolStats struct {
	OpenConnections int
	Idle            int
	InUse           int
	WaitCount       int64
	WaitDuration    time.Duration
}

DBPoolStats holds snapshot statistics for a database connection pool. SEM@82a346411b061b20ff839bbbd4281294e94d82ff: snapshot of database connection pool counters (pure)

type RedactingSpanExporter

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

RedactingSpanExporter wraps an sdktrace.SpanExporter so that span attributes matching the sensitive-key catalog are replaced with "<redacted>" before they reach the OTLP collector. This is the defense-in-depth fix for T23 — even if a future instrumentation path sets `attribute.String("authorization", header)` directly, the value never leaves the process. SEM@ad7cd6a870c6ca3d54d847943b47256a0b5325f2: OTel span exporter that strips credential values from attributes before forwarding to a collector

func NewRedactingSpanExporter

func NewRedactingSpanExporter(inner sdktrace.SpanExporter) *RedactingSpanExporter

NewRedactingSpanExporter wraps the given exporter with attribute redaction. Returns inner verbatim if it is nil. SEM@ad7cd6a870c6ca3d54d847943b47256a0b5325f2: build a RedactingSpanExporter wrapping the given span exporter (pure)

func (*RedactingSpanExporter) ExportSpans

func (r *RedactingSpanExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

ExportSpans redacts sensitive attribute values before forwarding to the wrapped exporter. SEM@ad7cd6a870c6ca3d54d847943b47256a0b5325f2: redact sensitive span attributes then forward the spans to the wrapped exporter

func (*RedactingSpanExporter) Shutdown

func (r *RedactingSpanExporter) Shutdown(ctx context.Context) error

Shutdown forwards to the wrapped exporter. SEM@ad7cd6a870c6ca3d54d847943b47256a0b5325f2: forward shutdown to the wrapped span exporter

type RedisPoolStats

type RedisPoolStats struct {
	ActiveCount int
	IdleCount   int
}

RedisPoolStats holds snapshot statistics for a Redis connection pool. SEM@82a346411b061b20ff839bbbd4281294e94d82ff: snapshot of Redis connection pool counters (pure)

type TMIMetrics

type TMIMetrics struct {
	CacheHits                   metric.Int64Counter
	CacheMisses                 metric.Int64Counter
	WebSocketActiveSessions     metric.Int64UpDownCounter
	WebSocketActiveParticipants metric.Int64UpDownCounter
	WebSocketMessages           metric.Int64Counter
	WebhookDeliveries           metric.Int64Counter
	WebhookResponseTooLarge     metric.Int64Counter
	WebhookResponseHeaderTO     metric.Int64Counter
	WebhookCircuitOpen          metric.Int64Counter
	TimmyActiveSessions         metric.Int64UpDownCounter
	TimmyLLMDuration            metric.Float64Histogram
	TimmyLLMTokens              metric.Int64Counter
	TimmyEmbedDuration          metric.Float64Histogram
	TimmySSEDuration            metric.Float64Histogram
	TimmySSEEvents              metric.Int64Counter
}

TMIMetrics holds all custom OTel metric instruments for TMI. SEM@0aee687bf1c2b4e1819bf1c183575104459a14d4: holds all OTel metric instruments for cache, WebSocket, webhook, and Timmy subsystems (pure)

var GlobalMetrics *TMIMetrics

GlobalMetrics holds the TMI metrics instance for package-level access.

func NewTMIMetrics

func NewTMIMetrics() (*TMIMetrics, error)

NewTMIMetrics creates and registers all TMI metric instruments. SEM@0aee687bf1c2b4e1819bf1c183575104459a14d4: build and register all TMI OTel metric instruments with the global meter (mutates shared state)

Jump to

Keyboard shortcuts

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