Skip to main content

Module analytics

Module analytics 

Source
Expand description

Analytics Module for Memvid CLI

Provides anonymous telemetry tracking with:

  • Zero latency impact (async fire-and-forget)
  • Local JSONL queue with background flush
  • SHA256-based anonymous IDs
  • Opt-out via MEMVID_TELEMETRY=0

Re-exports§

pub use self::track_command_with_tier as track_command_tier;

Structs§

AnalyticsEvent
Analytics event structure

Functions§

flush_analytics
Public function to trigger a flush (async spawn)
force_flush_sync
Force flush analytics synchronously (ignores interval check) Call this at the end of main() to ensure events are sent
generate_anon_id
Generate an anonymous ID for a user Format: anon_ + SHA256(machine_id + optional_file)[:16]
generate_file_hash
Generate a hash for a file path Used to track file activity without revealing the actual path
init_analytics
Initialize analytics (called once at startup) Checks environment variable and starts background flush
is_telemetry_enabled
Check if telemetry is enabled Set MEMVID_TELEMETRY=0 to disable
track_command
Convenience function to track a command execution
track_command_with_tier
Track a command execution with user tier info
track_event
Track an analytics event (append to local queue) This is fire-and-forget - errors are silently ignored