mirror of
https://github.com/hanzoai/o11y-foundry.git
synced 2026-11-02 14:03:05 +00:00
## Summary - Extract \`DistinctID\`, \`Event\`, and \`Properties\` value objects from \`internal/ledger\` into \`internal/domain\` so they can be reused without coupling callers to ledger orchestration. Move the analytics serializer to \`api/v1alpha1\` as \`Casting.TrackableProperties()\`. Tighten \`Ledger.Track\` to take \`domain.Event\` and \`domain.Properties\`. - Add \`cmd/foundryctl/root.go\` with shared \`rootLogger\`/\`rootTracker\` initialized via \`PersistentPreRunE\`, plus \`recoverRunE\` — a wrapper that converts panics to \`TypeFatal\` errors and centralizes log + ledger tracking of success/failure for every command. Each \`runX\` collapses to \`(domain.Properties, error)\` with no in-function tracking. - Add \`WithStacktrace\` on \`*base\` errors so the recovered panic stack flows through the existing \`LogAttr\` machinery.
18 lines
472 B
Go
18 lines
472 B
Go
// Package ledger provides anonymous usage tracking for foundryctl commands.
|
|
package ledger
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/signoz/foundry/internal/domain"
|
|
)
|
|
|
|
// Ledger is the interface for tracking CLI usage events.
|
|
type Ledger interface {
|
|
// Track records a single foundryctl event with the given properties.
|
|
Track(ctx context.Context, event domain.Event, properties domain.Properties)
|
|
|
|
// Close flushes any pending events and releases resources.
|
|
Close() error
|
|
}
|