Repository navigation
Tag every event with the program's version; version is now required (0.3.0) - #6
Merged
Merged
Conversation
…0.3.0) TraceClient takes the program's own version as a required third positional argument, trimmed; a missing/blank one or one over 255 characters raises ValueError. Every event the client sends carries it as the tag `version`, unless the event's own tags already have one. The caller's tags are copied, never modified. TraceClient.disabled() uses an internal placeholder version. The User-Agent still names the client's version, and the opt-out logic is unchanged. Mirrors trace-client-java PR #5. Breaking change: 0.2.0 -> 0.3.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
…ry-event Keeps #4's name check inside report()'s try and applies _with_version there; the two tests #4 added now pass a program version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
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
Every event the Python client sends now carries the program's own version as the tag
version, matching the change made in the Java client (Stephenson-Software/trace-client-java#5).TraceClient(base_url, application, version, *, key=None, enabled=True): the program version is a required third positional argument. It is trimmed;None, a blank string, or one longer than 255 characters after trimming raisesValueError.MAX_TAG_LENGTH = 255is exported.startup,command, anything) is sent withversion= that program version. If the event's own tags already containversion, the event's value wins. The caller's tags dict is copied, never modified (new_with_versionhelper, mirroring Java'swithVersion). The Python client has no server-wide tags, so the precedence is simply event tags > program version.TraceClient.disabled()still constructs, with an internal placeholder version"disabled".trace-client-python/0.3.0 (App)), and the opt-out logic (environment,enabled, key) is untouched.__version__,pyproject.tomland both file headers.Docs
The README example now passes
__version__and no longer tagsstartupby hand. A new section, "Every event carries the program's version", covers the required argument, the tag on every event, the event's own tag winning, and upgrading from 0.2.0. The wire-format example now shows acommandevent carryingversion. The repo has no CHANGELOG.Tests
Existing tests were updated to the new signature and expected bodies. New tests cover: a command event tagged with the trimmed version, an event's own
versionwinning (with the caller's dict unchanged),reportnever modifying the caller's tags,_with_versioncopying rather than mutating, and a missing/blank/overlong version being rejected (a version of exactly 255 characters is accepted).python -m unittest -v(the CI command): 26 tests pass on Python 3.8.10 and 3.11.15.report, 4 tests fail; restored, all 26 pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01AuTszT2gqv7nLVYrtKD4ji
drafted by Claude on behalf of Daniel Stephenson