telemetry

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package telemetry provides OpenTelemetry tracing foundation for tako-cli. Tracing is disabled by default and can be enabled via environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(cfg Config) error

Init initializes the telemetry system. Call this early in main() if you want tracing enabled. If OTEL_EXPORTER_OTLP_ENDPOINT is not set, tracing is disabled (noop).

func IsEnabled

func IsEnabled() bool

IsEnabled returns true if tracing is enabled

func RecordError

func RecordError(ctx context.Context, err error)

RecordError records an error on the current span

func SetAttribute

func SetAttribute(ctx context.Context, key string, value interface{})

SetAttribute sets an attribute on the current span

func Shutdown

func Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the tracer provider

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

SpanFromContext returns the current span from context

func StartSpan

func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)

StartSpan starts a new span with the given name

func TraceDeploy

func TraceDeploy(ctx context.Context, project, service, environment string) (context.Context, trace.Span)

TraceDeploy starts a span for deployment operations

func TraceHTTP

func TraceHTTP(ctx context.Context, method, url string) (context.Context, trace.Span)

TraceHTTP starts a span for HTTP operations

func TraceHealthCheck

func TraceHealthCheck(ctx context.Context, service, domain string) (context.Context, trace.Span)

TraceHealthCheck starts a span for health check operations

func TraceSSH

func TraceSSH(ctx context.Context, host, command string) (context.Context, trace.Span)

TraceSSH starts a span for SSH operations

func TraceState

func TraceState(ctx context.Context, operation, project string) (context.Context, trace.Span)

TraceState starts a span for state operations

func Tracer

func Tracer() trace.Tracer

Tracer returns the global tracer instance

Types

type Config

type Config struct {
	// ServiceName is the name of the service (default: tako-cli)
	ServiceName string
	// ServiceVersion is the version of the service
	ServiceVersion string
	// Environment is the deployment environment (e.g., production, staging)
	Environment string
	// OTLPEndpoint is the OTLP collector endpoint (e.g., localhost:4317)
	OTLPEndpoint string
	// OTLPInsecure disables TLS for local or explicitly trusted collectors.
	OTLPInsecure bool
	// Debug enables stdout trace exporter for debugging
	Debug bool
}

Config holds telemetry configuration

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default telemetry configuration

Jump to

Keyboard shortcuts

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