newrelic / newrelic-python-agent

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

Fix NewRelicContextFormatter bug #1084

Closed hmstepanek closed 6 months ago

hmstepanek commented 6 months ago

Overview

In v9.5.0, a bug in the NewRelicContextFormatter was introduced where "message" was added to the default set of keys to exclude. This made the default key list (default keys + 1) in length. Since the logic check was based on the length, rather than presence of certain keys, anything that had one extra key than the default would not have that extra key added to the ouput because the length would match the (default keys + 1) length.

The length check that was previously used was a bit of an odd choice. Replace this with a check for keys not in the default keys list.

github-actions[bot] commented 6 months ago

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON bandit 1 0 4.63s
✅ PYTHON black 2 0 0 0.86s
✅ PYTHON flake8 2 0 0.46s
✅ PYTHON isort 2 0 0 0.25s
✅ PYTHON pylint 2 0 3.69s

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_