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.
Recommended local stack ¶
VictoriaMetrics :8428 — metrics storage VictoriaLogs :9428 — log storage Grafana :9429 — dashboards
See docs/OBSERVABILITY.md for the full reference.
Index ¶
- func Enabled() bool
- func Init(ctx context.Context, serviceName, version string) error
- func Meter(name string) metric.Meter
- func Shutdown(ctx context.Context)
- func Tracer(name string) trace.Tracer
- func WrapStorage(s storage.Storage) storage.Storage
- type InstrumentedStorage
- func (s *InstrumentedStorage) AddDependency(ctx context.Context, dep *types.Dependency, actor string) error
- func (s *InstrumentedStorage) AddIssueComment(ctx context.Context, issueID, author, text string) (*types.Comment, error)
- func (s *InstrumentedStorage) AddLabel(ctx context.Context, issueID, label, actor string) error
- func (s *InstrumentedStorage) Close() error
- func (s *InstrumentedStorage) CloseIssue(ctx context.Context, id string, reason string, actor string, session string) error
- func (s *InstrumentedStorage) CreateIssue(ctx context.Context, issue *types.Issue, actor string) error
- func (s *InstrumentedStorage) CreateIssues(ctx context.Context, issues []*types.Issue, actor string) error
- func (s *InstrumentedStorage) DeleteIssue(ctx context.Context, id string) error
- func (s *InstrumentedStorage) GetAllConfig(ctx context.Context) (map[string]string, error)
- func (s *InstrumentedStorage) GetAllEventsSince(ctx context.Context, sinceID int64) ([]*types.Event, error)
- func (s *InstrumentedStorage) GetBlockedIssues(ctx context.Context, filter types.WorkFilter) ([]*types.BlockedIssue, error)
- func (s *InstrumentedStorage) GetConfig(ctx context.Context, key string) (string, error)
- func (s *InstrumentedStorage) GetDependencies(ctx context.Context, issueID string) ([]*types.Issue, error)
- func (s *InstrumentedStorage) GetDependenciesWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error)
- func (s *InstrumentedStorage) GetDependencyTree(ctx context.Context, issueID string, maxDepth int, showAllPaths bool, ...) ([]*types.TreeNode, error)
- func (s *InstrumentedStorage) GetDependents(ctx context.Context, issueID string) ([]*types.Issue, error)
- func (s *InstrumentedStorage) GetDependentsWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error)
- func (s *InstrumentedStorage) GetEpicsEligibleForClosure(ctx context.Context) ([]*types.EpicStatus, error)
- func (s *InstrumentedStorage) GetEvents(ctx context.Context, issueID string, limit int) ([]*types.Event, error)
- func (s *InstrumentedStorage) GetIssue(ctx context.Context, id string) (*types.Issue, error)
- func (s *InstrumentedStorage) GetIssueByExternalRef(ctx context.Context, externalRef string) (*types.Issue, error)
- func (s *InstrumentedStorage) GetIssueComments(ctx context.Context, issueID string) ([]*types.Comment, error)
- func (s *InstrumentedStorage) GetIssuesByIDs(ctx context.Context, ids []string) ([]*types.Issue, error)
- func (s *InstrumentedStorage) GetIssuesByLabel(ctx context.Context, label string) ([]*types.Issue, error)
- func (s *InstrumentedStorage) GetLabels(ctx context.Context, issueID string) ([]string, error)
- func (s *InstrumentedStorage) GetReadyWork(ctx context.Context, filter types.WorkFilter) ([]*types.Issue, error)
- func (s *InstrumentedStorage) GetStatistics(ctx context.Context) (*types.Statistics, error)
- func (s *InstrumentedStorage) RemoveDependency(ctx context.Context, issueID, dependsOnID string, actor string) error
- func (s *InstrumentedStorage) RemoveLabel(ctx context.Context, issueID, label, actor string) error
- func (s *InstrumentedStorage) RunInTransaction(ctx context.Context, commitMsg string, fn func(tx storage.Transaction) error) error
- func (s *InstrumentedStorage) SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error)
- func (s *InstrumentedStorage) SetConfig(ctx context.Context, key, value string) error
- func (s *InstrumentedStorage) UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error
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 ¶
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 Shutdown ¶
Shutdown flushes all spans/metrics and shuts down OTel providers. Should be deferred in PersistentPostRun with a short-lived context.
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 (*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 (*InstrumentedStorage) CreateIssue ¶
func (*InstrumentedStorage) CreateIssues ¶
func (*InstrumentedStorage) DeleteIssue ¶
func (s *InstrumentedStorage) DeleteIssue(ctx context.Context, id string) error
func (*InstrumentedStorage) GetAllConfig ¶
func (*InstrumentedStorage) GetAllEventsSince ¶
func (*InstrumentedStorage) GetBlockedIssues ¶
func (s *InstrumentedStorage) GetBlockedIssues(ctx context.Context, filter types.WorkFilter) ([]*types.BlockedIssue, error)
func (*InstrumentedStorage) GetDependencies ¶
func (*InstrumentedStorage) GetDependenciesWithMetadata ¶
func (s *InstrumentedStorage) GetDependenciesWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error)
func (*InstrumentedStorage) GetDependencyTree ¶
func (*InstrumentedStorage) GetDependents ¶
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) GetIssueByExternalRef ¶
func (*InstrumentedStorage) GetIssueComments ¶
func (*InstrumentedStorage) GetIssuesByIDs ¶
func (*InstrumentedStorage) GetIssuesByLabel ¶
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 (*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