Conversation
Each run builds one event from what the command reports as it runs (the parse, the token, each request, stdout bytes, the error code) and hands it to a sink at exit: a JSON line in ~/.mapbox/.telemetry/<date>.jsonl by default, or Mapbox Events through a detached child with MAPBOX_CLI_TELEMETRY_SINK=api. Argument values leave only when they come from a fixed set; free strings are sent as a length, files as a size. Every request now goes through http::send, which records it; a source guard holds that.
zmofei
force-pushed
the
telemetry-events
branch
from
September 24, 2026 12:18
bed039d to
01569df
Compare
telemetry.rs is the User-Agent markers; the event is a separate module, and its name should say it is telemetry rather than a generic "events".
telemetry_event decides what the event contains; telemetry_sink decides where it goes. FileSink writes the local file for testing; HttpSink is the interface for Mapbox Events, documented but not implemented, so the detached sender, http::bare_client and the sink/debug variables are gone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP — not ready for review.
Each run now records one
cli.commandtelemetry event, following the draft schema in the Telemetry proposal. By default the event is appended to~/.mapbox/.telemetry/<UTC date>.jsonl(kept 7 days) and nothing leaves the machine.What's in it
src/telemetry_event.rs: decides what the event contains. It collects what the run reports (command path, invocation, params, options, token prefix and account, exit and error codes, stdout bytes, duration, requests), and builds the event at exit.src/telemetry_sink.rs: where the event goes. ASinktrait with two implementations;selected()is the one place that picks one:FileSink(used today) appends one JSON line per run. It's for local testing.HttpSinkis the interface for Mapbox Events, with its contract written down. It's not implemented, so it isn't selected.language/country/types. Free strings send their length,--fileits size,--dataits size and top-level keys.lon/latsend their name only.http::send, which records it. A new source guard,only_http_sends_requests, keeps it that way.MAPBOX_CLI_NO_TELEMETRY=1. A persistedmapbox config set telemetry offis in the stacked PR WIP: Add a persisted telemetry setting to mapbox config #47.errorCode: "panic".completionrecords nothing, since it runs at every shell startup.Behavior changes to confirm
~/.mapbox/.telemetry/, including runs that previously touched nothing on disk.tests/non_interactive.rswas narrowed to allow that directory after a refusedauth login.Before
HttpSinkis implementedcli.commandhas to be registered inmapbox/event-schemaand get a warehouse table.Not checked
tilesets-cliexit path hasn't been compiled locally.HttpSinkis an interface only.installMethodis inferred from the binary's location, so it readsotherwhenMAPBOX_INSTALL_DIRwas used.