Help us shape the future of Go! Take the 2026 Go Developer Survey

telemetry

package
v0.54.15 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package telemetry contains opt-in runtime telemetry setup helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RedactTelemetryValue

func RedactTelemetryValue(input string) string

Types

type EnvLookup

type EnvLookup func(string) (string, bool)

type OTelConfig

type OTelConfig struct {
	ServiceName        string
	ServiceVersion     string
	Environment        string
	RunID              string
	TenantDeploymentID string
	StackKit           string
	Provider           string
	NodeID             string
}

type OTelRuntime

type OTelRuntime struct {
	// Enabled reports export: ResolveOTelRuntime sets it from the configured
	// endpoint, and SetupOTel clears it when the exporter could not be created.
	// SetupOTel installs local instrumentation independently of this flag.
	Enabled            bool
	Endpoint           string
	Protocol           string
	Headers            map[string]string
	ServiceName        string
	ServiceVersion     string
	Environment        string
	RunID              string
	TenantDeploymentID string
	StackKit           string
	Provider           string
	NodeID             string
	ResourceAttributes map[string]string
}

func ResolveOTelRuntime

func ResolveOTelRuntime(cfg OTelConfig, lookup EnvLookup) OTelRuntime

func SetupOTel

func SetupOTel(ctx context.Context, cfg OTelConfig) (OTelRuntime, func(context.Context) error, error)

func SetupOTelWithLookup

func SetupOTelWithLookup(ctx context.Context, cfg OTelConfig, lookup EnvLookup) (OTelRuntime, func(context.Context) error, error)

SetupOTelWithLookup always installs the local resource, tracer provider and W3C trace-context plus baggage propagation, and returns the shutdown that removes them. The returned error reports only that the configured exporter could not be created (for example an endpoint the profile denies). It is not a setup failure: the runtime and shutdown stay valid, runtime.Enabled is false because nothing is exported, and no other destination is substituted.

type SentryCaptureOptions

type SentryCaptureOptions struct {
	Transport    sentry.Transport
	FlushTimeout time.Duration
}

type SentryConfig

type SentryConfig struct {
	DSN                string
	Environment        string
	Release            string
	RunID              string
	TenantDeploymentID string
	StackKit           string
	Phase              string
	FailureClass       string
	Provider           string
	RolloutMode        string
	Tags               map[string]string
}

type SentryFailureEvent

type SentryFailureEvent struct {
	EventID         string            `json:"eventId"`
	SentryEventID   string            `json:"sentryEventId,omitempty"`
	SentryDelivered bool              `json:"sentryDelivered"`
	CapturedAt      time.Time         `json:"capturedAt"`
	Status          string            `json:"status"`
	Message         string            `json:"message"`
	Environment     string            `json:"environment,omitempty"`
	Release         string            `json:"release,omitempty"`
	Tags            map[string]string `json:"tags,omitempty"`
	Issues          []string          `json:"issues,omitempty"`
	Redaction       string            `json:"redaction"`
	DeliveryMode    string            `json:"deliveryMode"`
}

type SentryRuntime

type SentryRuntime struct {
	Enabled            bool
	DSN                string
	Environment        string
	Release            string
	ForbiddenAuthToken bool
	Tags               map[string]string
	Issues             []string
}

func CaptureSentryFailure

func CaptureSentryFailure(root string, cfg SentryConfig, message string, lookup EnvLookup) (string, SentryRuntime, error)

func CaptureSentryFailureWithOptions

func CaptureSentryFailureWithOptions(root string, cfg SentryConfig, message string, lookup EnvLookup, options SentryCaptureOptions) (string, SentryRuntime, error)

func ResolveSentryRuntime

func ResolveSentryRuntime(cfg SentryConfig, lookup EnvLookup) SentryRuntime

type SpanHandle

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

func StartSpan

func StartSpan(ctx context.Context, name string, attrs map[string]string) (context.Context, SpanHandle)

func (SpanHandle) AddEvent

func (h SpanHandle) AddEvent(name string, attrs map[string]string)

func (SpanHandle) End

func (h SpanHandle) End()

func (SpanHandle) IsRecording

func (h SpanHandle) IsRecording() bool

func (SpanHandle) RecordError

func (h SpanHandle) RecordError(err error)

func (SpanHandle) SetAttributes

func (h SpanHandle) SetAttributes(attrs map[string]string)

func (SpanHandle) SetRolloutStatus

func (h SpanHandle) SetRolloutStatus(status, description string)

Jump to

Keyboard shortcuts

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