Documentation
¶
Overview ¶
Package telemetry provides OpenTelemetry tracing foundation for tako-cli. Tracing is disabled by default and can be enabled via environment variables.
Index ¶
- func Init(cfg Config) error
- func IsEnabled() bool
- func RecordError(ctx context.Context, err error)
- func SetAttribute(ctx context.Context, key string, value interface{})
- func Shutdown(ctx context.Context) error
- func SpanFromContext(ctx context.Context) trace.Span
- func StartSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, trace.Span)
- func TraceDeploy(ctx context.Context, project, service, environment string) (context.Context, trace.Span)
- func TraceHTTP(ctx context.Context, method, url string) (context.Context, trace.Span)
- func TraceHealthCheck(ctx context.Context, service, domain string) (context.Context, trace.Span)
- func TraceSSH(ctx context.Context, host, command string) (context.Context, trace.Span)
- func TraceState(ctx context.Context, operation, project string) (context.Context, trace.Span)
- func Tracer() trace.Tracer
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Init ¶
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 RecordError ¶
RecordError records an error on the current span
func SetAttribute ¶
SetAttribute sets an attribute on the current span
func SpanFromContext ¶
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 TraceHealthCheck ¶
TraceHealthCheck starts a span for health check operations
func TraceState ¶
TraceState starts a span for state operations
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
// Debug enables stdout trace exporter for debugging
Debug bool
}
Config holds telemetry configuration
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default telemetry configuration