newrelic / newrelic-python-agent

New Relic Python Agent
https://docs.newrelic.com/docs/agents/python-agent
Apache License 2.0
178 stars 102 forks source link

Drop attributes with a value of None #1064

Closed hmstepanek closed 8 months ago

hmstepanek commented 9 months ago

Overview

This PR attempts to align the Python agent with the agent spec by dropping attributes with a value of None.

According to the spec:

Agents SHOULD NOT report null attribute values. The behavior of IS NULL queries in insights makes it so that omitted keys behave the same as null keys. Since there is no difference between omitting the key and sending a null, we SHOULD reduce the payload size by omitting null values from the payload entirely.

Since there should not be a difference in behavior for customers recording null attributes versus customers omitting an attribute, agents SHOULD add debug logging when a null value is recorded. This will give agents observability on recording of null attributes outside of audit logs.

"empty" values such as "" and 0 MUST be sent as an attribute in the payload.

It also performs some minor cleanup and adds descriptions to some function inside our attribute filtering system. It also contains a fix for previously failing sklearn tests due to a non integer version: 0.0.post12.

Recommended review strategy: review each commit one at a time.

github-actions[bot] commented 9 months ago

šŸ¦™ MegaLinter status: āŒ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
āœ… PYTHON bandit 6 0 5.4s
āœ… PYTHON black 14 0 0 1.92s
āœ… PYTHON flake8 14 0 1.04s
āœ… PYTHON isort 14 0 0 0.33s
āŒ PYTHON pylint 14 30 7.53s

See detailed report in MegaLinter reports _Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff_

_MegaLinter is graciously provided by OX Security_

codecov-commenter commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (6fd639d) 76.36% compared to head (03c1f50) 76.37%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1064 +/- ## ======================================= Coverage 76.36% 76.37% ======================================= Files 190 190 Lines 19747 19748 +1 Branches 3468 3470 +2 ======================================= + Hits 15080 15082 +2 Misses 3656 3656 + Partials 1011 1010 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.