Documentation
¶
Overview ¶
Package telemetry owns generation event context identity and lifecycle orchestration.
Index ¶
- Variables
- func EventFromContext(ctx context.Context) *shared.CliEvent
- func Run(ctx context.Context, interactionType shared.InteractionType, ...) (resultErr error)
- func WithEvent(ctx context.Context, event *shared.CliEvent) context.Context
- func WithLifecycle(ctx context.Context, lifecycle Lifecycle) context.Context
- type Lifecycle
- type NoDeliveryLifecycle
Constants ¶
This section is empty.
Variables ¶
var ( // ErrLifecycleStart indicates that a telemetry lifecycle could not start. ErrLifecycleStart = errors.New("start telemetry lifecycle") // ErrNilEvent indicates that a telemetry lifecycle returned no active event. ErrNilEvent = errors.New("telemetry lifecycle returned a nil event") )
Functions ¶
func EventFromContext ¶
EventFromContext returns the active event, if any.
func Run ¶
func Run( ctx context.Context, interactionType shared.InteractionType, callback func(context.Context, *shared.CliEvent) error, ) (resultErr error)
Run starts an event, invokes the callback with the same event in its context, and finalizes the event after callback execution starts.
Types ¶
type Lifecycle ¶
type Lifecycle interface {
Start(context.Context, shared.InteractionType) (*shared.CliEvent, error)
Finish(context.Context, *shared.CliEvent, error) error
}
Lifecycle constructs and finalizes generation events. Delivery-capable implementations remain responsible for honoring access telemetry opt-out state.
type NoDeliveryLifecycle ¶
type NoDeliveryLifecycle struct{}
NoDeliveryLifecycle creates and finalizes real events without persistence or network delivery.
func (NoDeliveryLifecycle) Finish ¶
func (NoDeliveryLifecycle) Finish(_ context.Context, event *shared.CliEvent, callbackErr error) error
Finish records completion once and performs no persistence or delivery. Event mutation is single-writer; shared.CliEvent is not concurrency-safe.
func (NoDeliveryLifecycle) Start ¶
func (NoDeliveryLifecycle) Start(_ context.Context, interactionType shared.InteractionType) (*shared.CliEvent, error)
Start creates an event using local time and cryptographically random IDs.