Repository navigation
Send a random per-installation ID as the tag "install" (0.3.0) - #5
Merged
Merged
Conversation
Port of trace-client-java 0.5.0's installation ID. Every event carries the tag install when the program supplies an ID: installId: (trimmed, blank = none, over 255 chars throws like an overlong version) or installIdFile:, a path the program chooses, read or created by the new TraceClient.InstallIdFromFile(path). Resolved only after every opt-out, so a disabled client never makes up or writes an ID. An event's own install tag wins, and install is never added past the 32-tag limit. The ID in use is TraceClient.InstallId. 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.
Summary
trace-client-java 0.5.0's per-installation ID is ported to the C# client, so the trace server can count distinct installations rather than raw events. Version bumped 0.2.0 → 0.3.0 (csproj, file header,
TraceClient.Version).installon every event when the program supplies an ID. It is added afterversion; an event's owninstalltag wins; it is never added past the 32-tag limit (counted the wayJsoncounts, so the event is not dropped for it).installId:— explicit ID, trimmed; null/blank = none; over 255 characters throwsArgumentException(paraminstallId), exactly like an overlong version.installIdFile:— a path the program chooses. Used only wheninstallIdis not given.TRACE_USAGE_REPORTING/DO_NOT_TRACK,enabled: false, no key): a disabled client never generates or writes an ID.TraceClient.InstallId— the ID in use;nullwhen disabled or none.TraceClient.InstallIdFromFile(string path)— static helper: returns the first line matching^[A-Za-z0-9_.-]{1,255}$; when the file is missing or has no such line, writes a newGuid(creating parent directories). A file that exists but cannot be read is not overwritten; any read/write failure, or a blank path, yields an in-memory ID. Never throws. There is no default location. Calling it directly writes whatever the opt-outs say; that is documented, andinstallIdFile:is recommended instead.Tests
New
tests/TraceClient.Tests/InstallIdTest.cs(13 tests) mirrors the Java suite: persist once + reuse, first valid line read / junk file replaced, unwritable path (parent is a regular file) → in-memory without throwing, unreadable path not overwritten, client persists and sends the ID on every event, unwritable file still reports, disabled (config / no key /DO_NOT_TRACK/TRACE_USAGE_REPORTING) → nothing written and no ID, explicit ID trimmed and wins over the file, blank = no tag, overlong rejected, eventinstalloverride, tag cap.dotnet test -c Release -p:IncludeNetFramework=false(the CI command, net8.0) was run locally: 64 passed, 0 failed. The net48 leg runs only on CI (Windows).Not merged, tagged or released; no consumer repos touched.
🤖 Generated with Claude Code
https://claude.ai/code/session_014ztkfamsbEqQfcu76me5SL
drafted by Claude on behalf of Daniel Stephenson