Documentation
¶
Index ¶
- Constants
- func CollectDaily(tracker interface{}) error
- func FlushBatcher() error
- func ForgetConsent() error
- func IsEnabled() bool
- func Send(data *TelemetryData) error
- func SetConsent(enabled bool) error
- func ShowConsentPrompt()
- func TrackFeatureUsage(featureName string, details map[string]interface{}) error
- func TrackQuotaUsage(tier string, usagePct float64)
- func TrackRewrite(originalCmd, rewrittenCmd string, testRunner bool)
- func TrackTestRunnerUsage(runnerType string, autoDetected bool)
- type ConsentStatus
- type EventBatcher
- type TelemetryData
Constants ¶
const ( TelemetryEndpoint = "https://api.tokman.dev/v1/telemetry" ConsentFile = "telemetry_consent" )
Variables ¶
This section is empty.
Functions ¶
func CollectDaily ¶ added in v0.28.0
func CollectDaily(tracker interface{}) error
CollectDaily collects and sends daily telemetry
func FlushBatcher ¶ added in v0.28.0
func FlushBatcher() error
FlushBatcher flushes all pending telemetry events
func ForgetConsent ¶ added in v0.28.0
func ForgetConsent() error
ForgetConsent removes consent and all local telemetry data
func IsEnabled ¶ added in v0.28.0
func IsEnabled() bool
IsEnabled returns true if telemetry is enabled
func Send ¶ added in v0.28.0
func Send(data *TelemetryData) error
Send sends telemetry data (if enabled)
func SetConsent ¶ added in v0.28.0
SetConsent sets the telemetry consent status
func ShowConsentPrompt ¶ added in v0.28.0
func ShowConsentPrompt()
ShowConsentPrompt displays the interactive consent prompt
func TrackFeatureUsage ¶ added in v0.28.0
TrackFeatureUsage tracks usage of specific features (test-runner, quota, etc.)
func TrackQuotaUsage ¶ added in v0.28.0
TrackQuotaUsage tracks gain --quota usage
func TrackRewrite ¶ added in v0.28.0
TrackRewrite tracks command rewrite events
func TrackTestRunnerUsage ¶ added in v0.28.0
TrackTestRunnerUsage tracks test-runner command usage
Types ¶
type ConsentStatus ¶ added in v0.28.0
type ConsentStatus int
ConsentStatus represents the user's telemetry consent
const ( ConsentUnknown ConsentStatus = iota ConsentEnabled ConsentDisabled )
func GetConsent ¶ added in v0.28.0
func GetConsent() ConsentStatus
GetConsent returns the current consent status
type EventBatcher ¶ added in v0.28.0
type EventBatcher struct {
// contains filtered or unexported fields
}
EventBatcher batches telemetry events for efficient sending
func GetBatcher ¶ added in v0.28.0
func GetBatcher() *EventBatcher
GetBatcher returns the global event batcher
func (*EventBatcher) AddEvent ¶ added in v0.28.0
func (b *EventBatcher) AddEvent(event map[string]interface{})
AddEvent adds an event to the batch
func (*EventBatcher) Flush ¶ added in v0.28.0
func (b *EventBatcher) Flush() error
Flush sends all batched events
type TelemetryData ¶ added in v0.28.0
type TelemetryData struct {
// Identity (anonymized)
DeviceHash string `json:"device_hash"`
// Environment
Version string `json:"version"`
OS string `json:"os"`
Arch string `json:"arch"`
InstallMethod string `json:"install_method,omitempty"`
// Usage volume (24h)
CommandCount int `json:"command_count_24h"`
TotalCommands int `json:"total_commands"`
TokensSaved24h int `json:"tokens_saved_24h"`
TokensSaved30d int `json:"tokens_saved_30d"`
TokensSavedTotal int `json:"tokens_saved_total"`
// Quality
ParseFailures int `json:"parse_failures"`
PassthroughCmds []string `json:"passthrough_cmds,omitempty"` // Top 5, no args
// Ecosystem
CommandCategories map[string]int `json:"command_categories,omitempty"`
// Retention
DaysSinceFirstUse int `json:"days_since_first_use"`
ActiveDays30d int `json:"active_days_30d"`
// Adoption
AgentHookType string `json:"agent_hook_type,omitempty"`
CustomFilterCount int `json:"custom_filter_count"`
// Features
MetaCommandsUsed []string `json:"meta_commands_used,omitempty"`
// Economics
EstimatedUSDSaved float64 `json:"estimated_usd_saved"`
Timestamp time.Time `json:"timestamp"`
}
TelemetryData represents the data sent to telemetry server