tracing

package
v6.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled

func Enabled() bool

Enabled returns true if OpenTelemetry tracing is configured.

func GetTracerProvider

func GetTracerProvider() oteltrace.TracerProvider

GetTracerProvider returns nuts-node's TracerProvider. This should be used by nuts-node components instead of otel.GetTracerProvider() to ensure spans are attributed to "nuts-node" service.

func RegisterAuditLogHook

func RegisterAuditLogHook(fn func(hook logrus.Hook))

RegisterAuditLogHook sets the function that registers a logrus hook with the audit logger. This is called by the audit package during initialization to avoid circular imports.

func SetEnabled

func SetEnabled(value bool)

SetEnabled sets the tracing enabled flag. Exported for testing only; do not call from production code.

Types

type Config

type Config struct {
	// Endpoint is the OTLP collector endpoint for tracing (e.g., "localhost:4318").
	// When empty, tracing is disabled.
	Endpoint string `koanf:"endpoint"`
	// Insecure disables TLS for the OTLP connection.
	Insecure bool `koanf:"insecure"`
	// ServiceName is the service name reported to the tracing backend.
	// Defaults to "nuts-node".
	ServiceName string `koanf:"servicename"`
}

Config contains settings for OpenTelemetry tracing.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the tracing engine.

type Engine

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

Engine is the engine that manages OpenTelemetry tracing. It must be registered first to ensure tracing is active before other engines start, and shut down last (due to reverse shutdown order) to capture all logs/spans.

func New

func New() *Engine

New creates a new tracing engine instance.

func (*Engine) CheckHealth

func (e *Engine) CheckHealth() map[string]core.Health

CheckHealth returns the health status of the tracing subsystem. When tracing is not configured or not running, no health entry is returned (not applicable). When enabled and running, we return UP since we successfully initialized - we can't easily verify OTLP endpoint connectivity as spans are exported asynchronously.

func (*Engine) Config

func (e *Engine) Config() any

Config returns the engine configuration.

func (*Engine) Configure

func (e *Engine) Configure(_ core.ServerConfig) error

Configure sets up OpenTelemetry tracing with the configured endpoint.

func (*Engine) Diagnostics

func (e *Engine) Diagnostics() []core.DiagnosticResult

Diagnostics returns diagnostic information about the tracing configuration.

func (*Engine) Name

func (e *Engine) Name() string

Name returns the engine name.

func (*Engine) Shutdown

func (e *Engine) Shutdown() error

Shutdown stops the tracing exporters and flushes any remaining spans/logs. Hooks remain registered but become no-ops after the OTEL providers are shut down.

func (*Engine) Start

func (e *Engine) Start() error

Start is a no-op since tracing is already active after Configure.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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