stats

package
v0.1.1245 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package stats counts magpie's users: once a day a running magpie tells PostHog it is in use, under an id made up on this computer, with its version and system, and, unless the user turned that part off, which agents, providers and models it is used with, by their built-in ids (Usage): a provider of the user's own is only "custom". No names, URLs, accounts, keys, prompts or usage go. Settings → Privacy turns it off, and so do DO_NOT_TRACK=1 and MAGPIE_NO_STATS=1; a build from source never sends it.

Index

Constants

View Source
const Key = "phc_nyDyYyrUTRGvNq5U7FBesCyM2j4GdKeqGp8ko7DBerTC"

Key is the Magpie project's key on PostHog: it can send events there and read nothing, so it is safe in the app.

Variables

This section is empty.

Functions

func Host

func Host() string

Host takes the events; MAGPIE_STATS_HOST points them elsewhere, for testing.

func Off

func Off() bool

Off reports whether the user said not to send it.

func Run

func Run(version, what string)

Run sends the day's event while magpie runs, as what ("app", "serve"): at start, and then whenever a new day (UTC) has begun. Only releases send it, unless MAGPIE_STATS_HOST is set.

func Send

func Send(ctx context.Context, version, what string, now time.Time) error

Send sends the event for now's day, unless it went already or the user turned it off.

Types

type Usage added in v0.1.1118

type Usage struct {
	Agents    []string // the agents connected to magpie: claude, codex
	Providers []string // the providers on: deepseek, codex (a subscription), plugin:kiro
	Models    []string // the models the connected agents are set to: deepseek/deepseek-v4, custom, group
	Groups    int      // routing groups shown
}

Usage is what the day's event says magpie is used with, when the user shares it: built-in ids only. A provider of the user's own is "custom", and so is a model on one; a plugin no one knows is "plugin".

Jump to

Keyboard shortcuts

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