telemetry

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package telemetry sends a fixed-schema, anonymous usage heartbeat unless it is turned off. It never sees memory content, subjects, predicates, database addresses or keys: callers hand it a tool name and nothing else.

TELEMETRY.md at the repository root lists every field. Keep Payload, that file and the collector's allowlist (polign_telemetry) in step.

Index

Constants

View Source
const Endpoint = "https://telemetry.polign.com/v1/recall/ping"

Endpoint is the only destination a heartbeat is sent to.

View Source
const Notice = "Recall sends anonymous usage statistics: version, platform, and counts of memory operations, never what is remembered. " +
	"See what is sent with `recall telemetry`; turn it off with `recall telemetry off` or RECALL_TELEMETRY=0."

Notice is what a user is told the first time an install ID is created.

Variables

This section is empty.

Functions

func Disabled

func Disabled(version, home string) string

Disabled says why telemetry is off for this build, environment and home, or "" when it is on.

func Once

func Once(cfg Config, notice func(string))

Once sends a single heartbeat for a command that does not stay running, such as setup, waiting at most two seconds.

func SetOff

func SetOff(home string, off bool) error

SetOff turns telemetry off (or back on) for everything that uses home.

Types

type Config

type Config struct {
	Version   string
	Home      string // the Recall home directory, where the install ID lives
	Mode      string
	Backend   string
	Embedder  string
	Extractor string
	Text      bool
}

Config describes the process a Reporter speaks for. Embedder and Extractor take the full provider:model spec; only the provider leaves the machine.

type Payload

type Payload struct {
	Version   string `json:"version"`
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	InstallID string `json:"install_id"`
	// ProcessID is random per run, so the collector can tell one process's
	// cumulative counters from the next one's.
	ProcessID string `json:"process_id"`
	Mode      string `json:"mode"`      // mcp, serve or setup
	Backend   string `json:"backend"`   // local, polign, qdrant, pgvector, mongodb
	Embedder  string `json:"embedder"`  // provider only: lexical, local, openai, ...
	Extractor string `json:"extractor"` // provider only, or none
	Surface   string `json:"surface"`   // text or typed
	Client    string `json:"client"`    // the MCP client's name over stdio, else ""

	UptimeSeconds uint64 `json:"uptime_seconds"`
	Remembers     uint64 `json:"remembers"`
	Recalls       uint64 `json:"recalls"`
	Forgets       uint64 `json:"forgets"`
	Replacements  uint64 `json:"replacements"`
	Inspections   uint64 `json:"inspections"`
	StateCalls    uint64 `json:"state_calls"`
	// Rollbacks counts State API writes refused with position_behind: the
	// caller was restored from an earlier point than its records.
	Rollbacks uint64 `json:"rollbacks"`
	// Repeats counts State API writes answered with what was already
	// recorded under the same message id, call id or outcome.
	Repeats uint64 `json:"repeats"`
}

Payload is the complete JSON body of a heartbeat.

func Preview

func Preview(cfg Config) Payload

Preview is the payload a process described by cfg would send, with zero counters. It reads the install ID when one exists and never creates one.

type Reporter

type Reporter struct {
	// contains filtered or unexported fields
}

Reporter counts tool calls and reports them from a background loop. A nil Reporter is telemetry turned off, and every method is safe on it.

func Start

func Start(cfg Config, notice func(string)) *Reporter

Start begins reporting for cfg and returns nil when telemetry is off or the install ID cannot be kept. notice is called once per install, the first time an ID is created. Nothing here blocks on the network.

func (*Reporter) Close

func (r *Reporter) Close()

Close stops the loop and sends the final counters, waiting at most two seconds so a process that is offline still exits promptly.

func (*Reporter) Repeat

func (r *Reporter) Repeat()

Repeat counts one State API write answered with what was already recorded.

func (*Reporter) Rollback

func (r *Reporter) Rollback()

Rollback counts one State API write refused because the caller was restored from an earlier point than its records.

func (*Reporter) SetClient

func (r *Reporter) SetClient(name string)

SetClient records the MCP client's name, as its initialize request gave it.

func (*Reporter) Snapshot

func (r *Reporter) Snapshot() Payload

Snapshot is what would be sent now.

func (*Reporter) Tool

func (r *Reporter) Tool(name string, replaced bool)

Tool counts one successful tool call. replaced says a remember call replaced something already believed.

Jump to

Keyboard shortcuts

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