ledger

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package ledger provides anonymous usage tracking for foundryctl commands.

Index

Constants

View Source
const (
	EventGauge   = "gauge"
	EventForge   = "forge"
	EventCast    = "cast"
	EventCatalog = "catalog"
)

Event names for foundryctl commands.

View Source
const (
	PropPlatform              = "platform"
	PropMode                  = "mode"
	PropFlavor                = "flavor"
	PropPatchesConfigured     = "patches_configured"
	PropPatchCount            = "patch_count"
	PropInfrastructureEnabled = "infrastructure_enabled"
	PropMetaStoreKind         = "metastore_kind"
	PropTelemetryStoreKind    = "telemetry_store_kind"
	PropTelemetryKeeperKind   = "telemetry_keeper_kind"
	PropSuccess               = "success"
	PropError                 = "error"
)

Property keys for casting details.

Variables

This section is empty.

Functions

func CastingProperties

func CastingProperties(casting v1alpha1.Casting) map[string]any

CastingProperties extracts trackable properties from a Casting config.

func WithError

func WithError(props map[string]any, err error) map[string]any

WithError adds success=false and the error message to the properties.

func WithSuccess

func WithSuccess(props map[string]any) map[string]any

WithSuccess adds success=true to the properties.

Types

type Config

type Config struct {
	Enabled bool
	Segment Segment
}

Config holds ledger configuration.

func NewConfig

func NewConfig() Config

NewConfig returns the default ledger configuration. The Segment write key is populated from the ldflags-injected value.

func (Config) Provider

func (c Config) Provider() string

Provider returns the provider name based on the configuration.

type Ledger

type Ledger interface {
	// Track records a single foundryctl event with the given properties.
	Track(ctx context.Context, event string, properties map[string]any)

	// Close flushes any pending events and releases resources.
	Close() error
}

Ledger is the interface for tracking CLI usage events.

type Segment

type Segment struct {
	Key string
}

Segment holds Segment-specific configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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