Repository navigation
Carry a random per-installation ID as the tag install (0.4.0) - #8
Merged
Merged
Conversation
Ports trace-client-java 0.5.0's installation ID. install_id= passes an explicit ID; install_id_file= loads one from, or writes a new random UUID to, a path the program chooses. Both are resolved only after the opt-outs, so a disabled client never makes up or writes an ID. An event's own install tag wins, and the tag never pushes an event past 32 tags. TraceClient.install_id_from_file(path) never raises: an unreadable or unwritable file yields an in-memory ID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014ztkfamsbEqQfcu76me5SL
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.
Ports the per-installation ID from trace-client-java 0.5.0, so the trace server can count distinct installations rather than raw events. Version bumped 0.3.0 → 0.4.0.
What changes
install_id=(constructor keyword): an explicit ID, sent as the taginstallon every event. Trimmed;None/blank means none; over 255 characters raisesValueError, the same way an overlong version does.install_id_file=(constructor keyword): a path the program chooses. The ID is loaded from it, or a new random UUID is written to it (parent directories created). An explicitinstall_id=wins over it.TraceClient.install_id_from_file(path)(static): the load-or-create step on its own. The first line matching[A-Za-z0-9_.-]{1,255}is the ID. It never raises: a file that exists but cannot be read is left alone and an in-memory UUID is returned; a write failure also yields an in-memory UUID.client.install_id(property): the ID in use,Nonewhen disabled or when none was given.TRACE_USAGE_REPORTING=off,DO_NOT_TRACK=1,enabled=False, no key): a disabled client never generates, reads or writes an ID.installtag wins.installis added afterversionand never pushes an event past 32 tags (newMAX_TAGSconstant;INSTALL_TAGexported too).installtag is sent, so existing integrations behave exactly as before.Tests
13 new tests mirroring the Java ones: persist once + reuse (nested parents created), first valid line read, a file with no valid line replaced, unwritable path → in-memory ID (path under a regular file, so it holds when run as root), unreadable path left alone, bad paths never raise, every opt-out writes nothing, explicit ID trimmed and wins over the file, blank = none / overlong rejected, an event's own
installtag wins, 32-tag cap respected.python -m unittest -v(the CI command): 41 tests pass locally on Python 3.8, 3.10 and 3.12.🤖 Generated with Claude Code
https://claude.ai/code/session_014ztkfamsbEqQfcu76me5SL
drafted by Claude on behalf of Daniel Stephenson