Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NewRelicContextFormatter bug #1084

Merged
merged 1 commit into from
Mar 6, 2024
Merged

Fix NewRelicContextFormatter bug #1084

merged 1 commit into from
Mar 6, 2024

Conversation

hmstepanek
Copy link
Contributor

@hmstepanek hmstepanek commented Mar 5, 2024

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.

Previously, there was a bug in NewRelicContextFormatter 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 is a bit odd here as it leads to a bug in the implementation.
Instead, let's check for presence of keys which is more reflective of our intended
goal than checking the length.
@hmstepanek hmstepanek requested a review from a team March 5, 2024 23:31
Copy link

github-actions bot commented Mar 5, 2024

🦙 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

@mergify mergify bot added the tests-failing label Mar 5, 2024
@hmstepanek hmstepanek merged commit 5f4b843 into main Mar 6, 2024
43 of 49 checks passed
@hmstepanek hmstepanek deleted the fix-context-logger-bug branch March 6, 2024 03:08
@mergify mergify bot removed the tests-failing label Mar 6, 2024
@umaannamalai umaannamalai added this to the v9.7.1 milestone Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants