otel

package
v0.16.8 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package otel provides OpenTelemetry setup for metrics (Prometheus) and optional tracing (OTLP HTTP). When disabled, global OTel providers remain no-ops with zero overhead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrometheusHandler

func PrometheusHandler() http.Handler

PrometheusHandler returns an HTTP handler that serves Prometheus metrics.

func Setup

func Setup(cfg Config, logger *slog.Logger) (shutdown func(context.Context) error, err error)

Setup initialises the global OTel meter and tracer providers. When cfg.Enabled is false it returns a no-op shutdown. The returned function must be called on process exit to flush pending telemetry.

Types

type Config

type Config struct {
	Enabled        bool
	TracesEndpoint string // OTLP HTTP endpoint, e.g. "http://localhost:4318"
	ServiceName    string // defaults to "denkeeper"
}

Config mirrors config.OTelConfig from the TOML layer.

Jump to

Keyboard shortcuts

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