Repository navigation
Leave out a value that is not a number, rather than sending it or losing the event - #38
Merged
Merged
Conversation
…ing the event (#37) A string or bool value went to the server as a JSON string or boolean, and a Decimal or numpy integer made json.dumps raise, which dropped the whole event. Real numbers are now sent as floats; anything else is left out like NaN, and the event still goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…other imports Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (scored against the diff and command output, assuming FAIL until shown otherwise):
Judgment call that was flagged:
Summary: a small fix with regression evidence, CI green on the full matrix, and the docs aligned. This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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
_jsonnow runsvaluethrough a new private_numberhelper. A real number (numbers.Realordecimal.Decimal, excludingbool) is sent as a JSON number, converted withfloat()when it is not a plainint/float. NaN, infinity, anythingfloat()overflows or refuses, and everything else (strings such as"3", bools, bytes, lists) is left out of the event, and the event itself is still sent."3"was sent as"value":"3"andTrueas"value":true. ADecimalor numpy integer madejson.dumpsraise, so the whole event was lost with only a DEBUGcould not queueline.reportdocstring and the README "The wire format" paragraph are updated to describe what happens to such values.Closes #37
Test plan
python3 -m unitteston Python 3.8.10 locally:Ran 76 tests,OKtrace_client/trace_client.pychange stashed, the three new tests fail (test_json_leaves_out_a_value_that_is_not_a_real_number_but_keeps_the_event,test_json_sends_other_real_numbers_as_floats,test_report_with_a_decimal_value_still_delivers_the_event). With the change restored, all 76 tests pass.test (3.8),test (3.10),test (3.12)greenJava parity
No Java-visible behavior changed. trace-client-java types
valueasDouble, so it cannot send a string, a boolean or a non-float number. This change makes the Python client's output on those inputs match what the Java client would send. Endpoint, headers and JSON field names are unchanged.Skipped issues
MAX_TAGScap) is still deferred. It needs an owner decision on the README's "tagsalways holds at leastversion" promise and a coordinated change in trace-client-java.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson