telemetry

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 11 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 reports that a version of Kivgraph ran on a machine for the first time, once, and nothing else.

What it measures and why it is not called *installations* is in `docs/adr/0083-a-download-is-not-a-person.md`; the fields it sends are documented in `docs/development/analytics.md` and published on https://kivgraph.dev/telemetry/. The endpoint that receives it is `landing/src/install-report.mjs`.

Three properties hold everywhere in this package, and each of them is a failure that would be invisible without a test:

  • **nothing reaches stdout.** `kivgraph serve` runs the MCP surface over stdio, where one stray byte corrupts the session. The daemon serves the same surface over HTTP, where it does not, and this code is shared: it obeys the stricter of the two everywhere. The notice goes to the writer the caller passes, which is stderr;
  • **the marker is a create, not a read.** stdio starts bursts -- ADR 0069 measured `69` starts of `serve` with `8` alive at once -- so a read-then-write would let a whole burst find the marker absent and report before any of them had created it. One install would become as many pings as the client happened to spawn;
  • **nothing here can fail a command.** Every error is dropped. A machine with no network runs Kivgraph exactly as one with it.

Index

Constants

View Source
const DisableEnv = "KIVGRAPH_TELEMETRY"

DisableEnv turns the whole package off when it is set to "0".

One variable, on the reader's side, and it is checked before anything is written: a machine that has opted out leaves no marker either, so opting back in reports the version it is running rather than nothing.

View Source
const Endpoint = "https://kivgraph.dev/api/telemetry/first-run"

Endpoint is where a ping goes.

Variables

This section is empty.

Functions

func Announce

func Announce(ctx context.Context, options Options) bool

Announce reports the first run of this version, or does nothing.

It returns whether a ping was sent, which is for tests and for a caller that wants to log it; every caller in this repository ignores it. It is synchronous: a caller that must not wait runs it in a goroutine, and the timeout above is what bounds that goroutine.

func Platform

func Platform() string

Platform names the build, in the vocabulary the release assets use.

The same string appears in `kivgraph-linux-amd64.tar.gz` and in the download series of Layer 0, so the two layers can be read side by side rather than joined by hand.

Types

type Options

type Options struct {
	// StateDirectory is where the marker lives. It is the state directory and
	// not the bundle root because an update replaces the bundle: a marker
	// there would fire again on every update, and the number would stop being
	// "the first run of a version".
	StateDirectory string
	// Version is the compiled version.Value.
	Version string
	// Transport is "stdio" or "daemon": which arrangement is about to serve.
	Transport string
	// Executable is os.Executable(); the channel is read from its layout.
	Executable string
	// Notice receives the one-time line telling the reader what was sent.
	// Never os.Stdout.
	Notice io.Writer

	// The seams, all optional. They exist so a test can drive the whole
	// function without a network, a home directory or a real clock.
	Endpoint string
	Client   *http.Client
	Getenv   func(string) string
}

Options is what a caller has to know to report a first run.

Jump to

Keyboard shortcuts

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