telemetry

package
v0.0.1-rc1 Latest Latest
Warning

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

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

Documentation

Overview

Package telemetry wires ruptor's opt-in OpenTelemetry tracing.

Security rule: telemetry is DISABLED by default. It is enabled only after explicit `ruptor auth login` (user knowingly connects to cloud) or by setting RUPTOR_TELEMETRY_ENABLED=true. The telemetry payload contains ONLY: command name, fault types used, run duration, ruptor version. NEVER: tool response content, agent output, file paths, user data, IP.

The v1 implementation provides the tracer plumbing so the rest of the code base can annotate spans; the OTLP exporter lands with the `ruptor auth login` PR (auth token required to hit telemetry.ruptor.dev).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordRun

func RecordRun(span trace.Span, command string, faultTypes []string, durationS float64, version string)

RecordRun annotates a span with the minimum fields the security model allows: command, fault types, duration seconds, version. Callers pass only non-sensitive values — the allowlist here is enforced by function signature.

Types

type Config

type Config struct {
	Enabled        bool
	ServiceVersion string
	// Endpoint is the OTLP collector URL. Empty disables the exporter
	// even when Enabled is true — useful for tests that want spans
	// but no network traffic.
	Endpoint string
}

Config controls telemetry startup.

type Provider

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

Provider wraps the tracer provider so callers can Shutdown cleanly without importing otel/sdk directly.

func Init

func Init(cfg Config) (*Provider, error)

Init constructs a Provider per cfg. When cfg.Enabled is false, a noop provider is returned and Shutdown is a no-op. The global otel TracerProvider is set to the new provider so callers that reach for otel.Tracer("...") see the same configuration.

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown flushes pending spans and releases exporter resources.

func (*Provider) Tracer

func (p *Provider) Tracer(name string) trace.Tracer

Tracer returns a named tracer. Safe to call even when telemetry is disabled — it will return a no-op tracer.

Jump to

Keyboard shortcuts

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