Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino committed Dec 20, 2023
1 parent 81d1f44 commit 2c837aa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions newrelic/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,10 @@ def default_otlp_host(host):
_settings.application_logging.forwarding.context_data.enabled = _environ_as_bool(
"NEW_RELIC_APPLICATION_LOGGING_FORWARDING_CONTEXT_DATA_ENABLED", default=False
)
_settings.application_logging.forwarding.context_data.include = _environ_as_bool(
_settings.application_logging.forwarding.context_data.include = _environ_as_set(
"NEW_RELIC_APPLICATION_LOGGING_FORWARDING_CONTEXT_DATA_INCLUDE", default=""
)
_settings.application_logging.forwarding.context_data.exclude = _environ_as_bool(
_settings.application_logging.forwarding.context_data.exclude = _environ_as_set(
"NEW_RELIC_APPLICATION_LOGGING_FORWARDING_CONTEXT_DATA_EXCLUDE", default=""
)
_settings.application_logging.metrics.enabled = _environ_as_bool(
Expand Down
12 changes: 7 additions & 5 deletions tests/testing_support/validators/validate_log_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ def _check_log_attributes(expected, required_attrs, forgone_attrs, captured, mis
return False

for key in forgone_attrs:
if hasattr(captured, key):
mismatches.append("forgone_key: %s, value:<%s>" % (key, getattr(captured, key, None)))
return False
elif key in captured.attributes:
mismatches.append("forgone_key: %s, value:<%s>" % (key, captured.attributes[key]))
if hasattr(captured, key) or key in captured.attributes:
if hasattr(captured, key):
captured_value = getattr(captured, key, None)
elif key in captured.attributes:
captured_value = captured.attributes[key]

mismatches.append("forgone_key: %s, value:<%s>" % (key, captured_value))
return False

return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ def _check_log_attributes(expected, required_attrs, forgone_attrs, captured, mis
return False

for key in forgone_attrs:
if hasattr(captured, key):
mismatches.append("forgone_key: %s, value:<%s>" % (key, getattr(captured, key, None)))
return False
elif key in captured.attributes:
mismatches.append("forgone_key: %s, value:<%s>" % (key, captured.attributes[key]))
if hasattr(captured, key) or key in captured.attributes:
if hasattr(captured, key):
captured_value = getattr(captured, key, None)
elif key in captured.attributes:
captured_value = captured.attributes[key]

mismatches.append("forgone_key: %s, value:<%s>" % (key, captured_value))
return False

return True
Expand Down

0 comments on commit 2c837aa

Please sign in to comment.