telemetry

package
v0.62.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package telemetry provides OpenTelemetry integration for beads.

Telemetry is opt-in: set BD_OTEL_METRICS_URL or BD_OTEL_STDOUT=true to activate. No overhead when neither variable is set.

Configuration

BD_OTEL_METRICS_URL=http://localhost:8428/opentelemetry/api/v1/push
    Push metrics to VictoriaMetrics (or any OTLP HTTP receiver).
    Presence of this variable enables telemetry.

BD_OTEL_LOGS_URL=http://localhost:9428/insert/opentelemetry/v1/logs
    Push logs to VictoriaLogs (reserved for future log export).

BD_OTEL_STDOUT=true
    Write spans and metrics to stderr (dev/debug mode).
    Also activates telemetry when set alone.
VictoriaMetrics :8428  — metrics storage
VictoriaLogs    :9428  — log storage
Grafana         :9429  — dashboards

See docs/OBSERVABILITY.md for the full reference.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Enabled

func Enabled() bool

Enabled reports whether telemetry is active. True when BD_OTEL_METRICS_URL is set or BD_OTEL_STDOUT=true.

func Init

func Init(ctx context.Context, serviceName, version string) error

Init configures OTel providers. When neither BD_OTEL_METRICS_URL nor BD_OTEL_STDOUT is set, installs no-op providers and returns immediately (zero overhead path).

Traces are exported only when BD_OTEL_STDOUT=true (stdout, for local debugging). Metrics are exported to BD_OTEL_METRICS_URL and/or stdout.

func Meter

func Meter(name string) metric.Meter

Meter returns a meter with the given instrumentation name (or the global scope).

func Shutdown

func Shutdown(ctx context.Context)

Shutdown flushes all spans/metrics and shuts down OTel providers. Should be deferred in PersistentPostRun with a short-lived context.

func Tracer

func Tracer(name string) trace.Tracer

Tracer returns a tracer with the given instrumentation name (or the global scope).

func WrapStorage

func WrapStorage(s storage.Storage) storage.Storage

WrapStorage returns s decorated with OTel instrumentation. When telemetry is disabled, s is returned as-is with zero overhead.

Types

type InstrumentedStorage

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

InstrumentedStorage wraps storage.Storage with OTel tracing and metrics. Every method gets a span and is counted in bd.storage.* metrics. Use WrapStorage to create one; it returns the original store unchanged when telemetry is disabled.

func (*InstrumentedStorage) AddDependency

func (s *InstrumentedStorage) AddDependency(ctx context.Context, dep *types.Dependency, actor string) error

func (*InstrumentedStorage) AddIssueComment

func (s *InstrumentedStorage) AddIssueComment(ctx context.Context, issueID, author, text string) (*types.Comment, error)

func (*InstrumentedStorage) AddLabel

func (s *InstrumentedStorage) AddLabel(ctx context.Context, issueID, label, actor string) error

func (*InstrumentedStorage) Close

func (s *InstrumentedStorage) Close() error

func (*InstrumentedStorage) CloseIssue

func (s *InstrumentedStorage) CloseIssue(ctx context.Context, id string, reason string, actor string, session string) error

func (*InstrumentedStorage) CreateIssue

func (s *InstrumentedStorage) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error

func (*InstrumentedStorage) CreateIssues

func (s *InstrumentedStorage) CreateIssues(ctx context.Context, issues []*types.Issue, actor string) error

func (*InstrumentedStorage) DeleteIssue

func (s *InstrumentedStorage) DeleteIssue(ctx context.Context, id string) error

func (*InstrumentedStorage) GetAllConfig

func (s *InstrumentedStorage) GetAllConfig(ctx context.Context) (map[string]string, error)

func (*InstrumentedStorage) GetAllEventsSince

func (s *InstrumentedStorage) GetAllEventsSince(ctx context.Context, sinceID int64) ([]*types.Event, error)

func (*InstrumentedStorage) GetBlockedIssues

func (s *InstrumentedStorage) GetBlockedIssues(ctx context.Context, filter types.WorkFilter) ([]*types.BlockedIssue, error)

func (*InstrumentedStorage) GetConfig

func (s *InstrumentedStorage) GetConfig(ctx context.Context, key string) (string, error)

func (*InstrumentedStorage) GetDependencies

func (s *InstrumentedStorage) GetDependencies(ctx context.Context, issueID string) ([]*types.Issue, error)

func (*InstrumentedStorage) GetDependenciesWithMetadata

func (s *InstrumentedStorage) GetDependenciesWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error)

func (*InstrumentedStorage) GetDependencyTree

func (s *InstrumentedStorage) GetDependencyTree(ctx context.Context, issueID string, maxDepth int, showAllPaths bool, reverse bool) ([]*types.TreeNode, error)

func (*InstrumentedStorage) GetDependents

func (s *InstrumentedStorage) GetDependents(ctx context.Context, issueID string) ([]*types.Issue, error)

func (*InstrumentedStorage) GetDependentsWithMetadata

func (s *InstrumentedStorage) GetDependentsWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error)

func (*InstrumentedStorage) GetEpicsEligibleForClosure

func (s *InstrumentedStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*types.EpicStatus, error)

func (*InstrumentedStorage) GetEvents

func (s *InstrumentedStorage) GetEvents(ctx context.Context, issueID string, limit int) ([]*types.Event, error)

func (*InstrumentedStorage) GetIssue

func (s *InstrumentedStorage) GetIssue(ctx context.Context, id string) (*types.Issue, error)

func (*InstrumentedStorage) GetIssueByExternalRef

func (s *InstrumentedStorage) GetIssueByExternalRef(ctx context.Context, externalRef string) (*types.Issue, error)

func (*InstrumentedStorage) GetIssueComments

func (s *InstrumentedStorage) GetIssueComments(ctx context.Context, issueID string) ([]*types.Comment, error)

func (*InstrumentedStorage) GetIssuesByIDs

func (s *InstrumentedStorage) GetIssuesByIDs(ctx context.Context, ids []string) ([]*types.Issue, error)

func (*InstrumentedStorage) GetIssuesByLabel

func (s *InstrumentedStorage) GetIssuesByLabel(ctx context.Context, label string) ([]*types.Issue, error)

func (*InstrumentedStorage) GetLabels

func (s *InstrumentedStorage) GetLabels(ctx context.Context, issueID string) ([]string, error)

func (*InstrumentedStorage) GetReadyWork

func (s *InstrumentedStorage) GetReadyWork(ctx context.Context, filter types.WorkFilter) ([]*types.Issue, error)

func (*InstrumentedStorage) GetStatistics

func (s *InstrumentedStorage) GetStatistics(ctx context.Context) (*types.Statistics, error)

func (*InstrumentedStorage) RemoveDependency

func (s *InstrumentedStorage) RemoveDependency(ctx context.Context, issueID, dependsOnID string, actor string) error

func (*InstrumentedStorage) RemoveLabel

func (s *InstrumentedStorage) RemoveLabel(ctx context.Context, issueID, label, actor string) error

func (*InstrumentedStorage) RunInTransaction

func (s *InstrumentedStorage) RunInTransaction(ctx context.Context, commitMsg string, fn func(tx storage.Transaction) error) error

func (*InstrumentedStorage) SearchIssues

func (s *InstrumentedStorage) SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error)

func (*InstrumentedStorage) SetConfig

func (s *InstrumentedStorage) SetConfig(ctx context.Context, key, value string) error

func (*InstrumentedStorage) UpdateIssue

func (s *InstrumentedStorage) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error

Jump to

Keyboard shortcuts

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