Conversation
zmofei
force-pushed
the
telemetry-events
branch
from
September 24, 2026 12:18
bed039d to
01569df
Compare
zmofei
force-pushed
the
telemetry-events
branch
from
September 28, 2026 09:04
bc5fadf to
9380184
Compare
zmofei
force-pushed
the
telemetry-events
branch
from
September 28, 2026 09:23
9380184 to
d96df00
Compare
This was referenced Sep 28, 2026
zmofei
force-pushed
the
telemetry-events
branch
from
September 28, 2026 11:34
d96df00 to
316be25
Compare
zmofei
force-pushed
the
telemetry-events
branch
from
September 28, 2026 11:37
316be25 to
8a1a4b0
Compare
zmofei
force-pushed
the
telemetry-events
branch
from
September 28, 2026 11:49
8a1a4b0 to
a1edc04
Compare
Each run appends one line of execution metadata to ~/.mapbox/history/<UTC date>.jsonl, kept 30 days: the command path from the command tree, invocation, exit code, error code, duration, request count and the last five request ids. Never an argument value, URL, error message or account: arguments carry search terms, file paths and ids. The file is written through dated_jsonl: private, one file per UTC day, pruned to the retention window. On by default. `mapbox config set history off` turns it off for good, MAPBOX_HISTORY=0 or =1 for a session over the setting. With it off, nothing is written and no directory is created. With it on, the config directory is created when missing, so history works the same for someone who only ever set MAPBOX_ACCESS_TOKEN. Not recorded: --help, --version, completion, history itself, and runs under sudo, whose root-owned files would stop the user's own runs appending (aws/aws-cli#10031). `mapbox history list` shows the most recent runs, newest first, and `mapbox history show [id]` one run, the newest by default, found by any prefix of its id. The read-only-command tests that held ~/.mapbox untouched now check both sides: with history on only `history/` may appear, with it off nothing.
- `history list` text output gets a header row. - Tests that hold a run to leaving nothing on disk turn history off in their helper instead of looping over both states; tests/history.rs checks what history leaves, and that skipped runs create nothing. - README says turning history off keeps what was already recorded. - Drop the setting count from config.rs's module doc, which every new key would have to edit.
Moves dated_jsonl::shed here from the diagnostic-log PR so history, on by default, is bounded by size as well as by age. trim now keeps exactly the bytes shed hands it; the margin was applied twice before.
zmofei
added this pull request to stack #60
September 28, 2026 12:18
Built from the run_record the foundation change already collects, so no call site changes here: telemetry_event chooses each field from the record under its privacy rules, and telemetry_sink delivers the line (to a local file for now, through dated_jsonl). run_record::finish hands the record to telemetry.
zmofei
force-pushed
the
telemetry-events
branch
from
September 28, 2026 12:21
a1edc04 to
b1ad124
Compare
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. Stacked on #56, for its
dated_jsonl; #57 below it owns collection: every call site reports torun_record. This PR changes no call site; it adds the telemetry projection of that record, the sink, and one line inrun_record::finishthat hands the record to telemetry.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. At exit it chooses each field from the run'srun_record::Record(command path, invocation, params, options, token prefix and account, exit and error codes, stdout bytes, duration, requests) under the rules below. The record holds raw facts, so this file is the whole of what can leave the machine.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, the single request path from Route every request through http::send and collect each run in run_record #57 (held byonly_http_sends_requests). Event files are written through Route every request through http::send and collect each run in run_record #57'sdated_jsonl.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.parentEventIdis read fromMAPBOX_CLI_PARENT_EVENT, and only when it is a UUID. A workflow will set it on the steps it launches, so amapboxrun inside a user's script is tied to its workflow instead of counted as direct use. For that,eventIdis fixed on first use (telemetry_event::event_id()), so a workflow can hand it to its steps before the event is built.workflowrecords the source (builtin,marketplaceorcustom), and the name only for workflows Mapbox names.set_workflowdrops the name forcustom, whatever the caller passes.stepCountand up to 20steps. A step is built only bycli_step(command names checked against the command tree, plus exit and error code) orscript_step(exit code and duration only), so a script step can't carry a command name or an error category.errorCode: "panic".completionrecords nothing, since it runs at every shell startup.Behavior changes to confirm
~/.mapboxalready exists; recording never creates or chmods it. Command history (Record command history and add mapbox history #56) is on by default and does create a missing~/.mapbox, so once both land, telemetry on a fresh machine starts recording from the second run.run_record::finish, andtests/telemetry_events.rs'swithout_a_config_directory_nothing_is_createdwill needMAPBOX_HISTORY=0once history can create the directory.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.