You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A value that is not a number is sent as-is, or loses the whole event #37
TraceClient.report(name, value, tags) documents value as "an optional numeric value", and the README's wire-format section says value is omitted only when not given or when it is NaN or infinite. _json in trace_client/trace_client.py does not check the type of value, though, so anything that is not a plain int/float goes straight to json.dumps:
value passed
What is sent / happens
"3" (e.g. read from a settings file)
{"...","value":"3"} -- a JSON string where the server expects a number
True
{"...","value":true}
decimal.Decimal("1"), a numpy int64
json.dumps raises TypeError; report() catches it and logs could not queue, so the whole event is lost, not just the value
trace-client-java cannot send any of these, because its value is typed Double. So on these inputs the Python client sends something the Java client never would.
Suggested fix: treat value the way NaN and infinity are already treated. Send any real number (numbers.Real, excluding bool) as a JSON number, convert it with float() when it is not a plain int/float, and leave every other value out of the event while still sending the event itself. Update the report docstring and the README wire-format sentence to match.
Activity
Leave out a value that is not a number, rather than sending it or los…