Skip to main content

Crate mesh_llm_analytics

Crate mesh_llm_analytics 

Source
Expand description

Anonymous, opt-out product analytics for mesh-llm.

§What this is

A narrow PostHog reporter for questions we cannot answer any other way: which platforms mesh-llm runs on, which commands people actually use, whether serve sessions survive, and how big real meshes get.

§What it is not

It is not the [telemetry] config section. That one is operator-facing OTLP: the operator points it at their own collector and nothing leaves their network. This crate is the only code in mesh-llm that reports to a vendor, and it is deliberately kept in one reviewable place.

§Design constraints

  • Closed vocabulary. Event and Properties admit no free-form String. Text only enters through Label::sanitize, whose grammar rejects paths, prose, and anything over-long. A prompt cannot reach the wire through this API even by mistake.
  • No key, no reporting. The project key is compiled in by the release pipeline. Source and development builds have none and are inert.
  • Never load-bearing. Capture is non-blocking, delivery is best effort, and no failure here changes a command’s behavior or exit code.
  • Anonymous by construction. The identifier is a random UUID with no derivation from the machine, and it is not the published mesh identity.

Structs§

ConsentInputs
Inputs to the consent decision, gathered from the environment.
InstallId
An install identifier, and whether this process created it.
Label
A grammar-checked string property.
PendingVersion
A read transition that has not been written back yet.
Properties
Properties attached to one event.
Status
How init resolved, for mesh-llm analytics status.

Enums§

BuildChannel
How this binary was built.
ConfigPreference
What the config file says about analytics.
Disposition
Why analytics is on or off.
Event
The closed set of events mesh-llm reports.
Value
A single property value. Deliberately not From<String>.
VersionTransition
What changed about the build version since the last run.

Constants§

DEFAULT_POSTHOG_HOST
Default ingestion host. PostHog US cloud.
ENV_ANALYTICS
Environment override for the analytics opt-out.
ENV_DO_NOT_TRACK
The cross-vendor opt-out convention (https://consoledonottrack.com).
ENV_INTERNAL_HELPER
Environment variable marking a process mesh-llm spawned as an internal helper rather than something a person ran.
ENV_POSTHOG_HOST
Runtime override for the ingestion host, for self-hosted PostHog.
ENV_POSTHOG_KEY
Runtime override for the ingestion project key.
ENV_SELF_UPDATE_MARKER
Environment variable the self-updater sets on the binary it execs.
INSTALL_ID_FILE
File name inside the mesh-llm state directory.
LIB_NAME
Library name reported to PostHog, so events from the node are separable from anything the website or console might send later.
NOTICE
The disclosure text shown once per install.
NOTICE_MARKER_FILE
Marker recording that the disclosure has been shown.
VERSION_FILE
File name inside the mesh-llm state directory.

Functions§

base_properties
Build the base property set for this process.
bucket_count
Bucket a count so a precise fingerprint never leaves the machine.
bucket_duration_secs
Bucket a duration in seconds into coarse session lengths.
bucket_gigabytes
Bucket a byte size into human power-of-two ranges.
capture
Queue one event. Never blocks; drops the event if the queue is full.
exec_env
How this process was started, as a fixed string.
ingestion_host
The ingestion host, preferring the runtime override.
init
Initialize analytics for this process.
load
Read the install identifier without creating one.
load_or_create
Load the install identifier from dir, generating it on first use.
project_key
The ingestion project key, preferring the runtime override.
shutdown
Deliver queued events, giving up after [SHUTDOWN_BUDGET].
state_dir
The default state directory, ~/.mesh-llm.