Skip to content

Commit

Permalink
Fix localhost setting for non-endpoint analytics calls [ethyca#1029] (e…
Browse files Browse the repository at this point in the history
…thyca#1130)

* Set local_host to None for non-endpoint analytics calls.  These are logging various tasks coming out of celery.

* Update Changelog.
  • Loading branch information
pattisdr authored Aug 23, 2022
1 parent 1b73fe0 commit 5e937ad
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The types of changes are:
* Escape the Redis user and password to make them URL friendly [#1104](https://github.com/ethyca/fidesops/pull/1104)
* Reduced number of connections opened against app db during health checks [#1107](https://github.com/ethyca/fidesops/pull/1107)
* Fix FIDESOPS__ROOT_USER__ANALYTICS_ID generation when env var is set [#1113](https://github.com/ethyca/fidesops/pull/1113)
* Set localhost to None for non-endpoint events [#1130](https://github.com/ethyca/fidesops/pull/1130)

### Changed

Expand Down
4 changes: 2 additions & 2 deletions src/fidesops/ops/graph/analytics_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def prepare_rerun_graph_analytics_event(
if step == ActionType.access
else "rerun_erasure_graph",
event_created_at=datetime.now(tz=timezone.utc),
local_host=False, # Temporarily defaulting to False, but we are going to change this to None
local_host=None,
endpoint=None,
status_code=None,
error=None,
Expand All @@ -98,7 +98,7 @@ def failed_graph_analytics_event(
docker=in_docker_container(),
event="privacy_request_execution_failure",
event_created_at=datetime.now(tz=timezone.utc),
local_host=False, # Temporarily defaulting to False, but we are going to change this to None
local_host=None,
endpoint=None,
status_code=500,
error=exc.__class__.__name__ if exc else None,
Expand Down
2 changes: 1 addition & 1 deletion tests/ops/graph/test_graph_analytics_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def test_create_failed_privacy_request_event(self, privacy_request):
assert analytics_event.error == "FidesopsException"
assert analytics_event.status_code == 500
assert analytics_event.endpoint is None
assert analytics_event.local_host is False
assert analytics_event.local_host is None
4 changes: 2 additions & 2 deletions tests/ops/graph/test_graph_differences.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def test_rerun_access_graph_analytics_event(
assert analytics_event.error is None
assert analytics_event.status_code is None
assert analytics_event.endpoint is None
assert analytics_event.local_host is False
assert analytics_event.local_host is None

def test_rerun_erasure_graph_analytics_event(
self, privacy_request, env_a_b, env_a_b_c, resources
Expand Down Expand Up @@ -914,4 +914,4 @@ def test_rerun_erasure_graph_analytics_event(
assert analytics_event.error is None
assert analytics_event.status_code is None
assert analytics_event.endpoint is None
assert analytics_event.local_host is False
assert analytics_event.local_host is None
4 changes: 2 additions & 2 deletions tests/ops/integration_tests/test_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def test_restart_graph_from_failure(
assert analytics_event.error is None
assert analytics_event.status_code is None
assert analytics_event.endpoint is None
assert analytics_event.local_host is False
assert analytics_event.local_host is None

assert (
db.query(ExecutionLog)
Expand Down Expand Up @@ -806,7 +806,7 @@ def test_restart_graph_from_failure_during_erasure(
assert analytics_event.error is None
assert analytics_event.status_code is None
assert analytics_event.endpoint is None
assert analytics_event.local_host is False
assert analytics_event.local_host is None

assert (
db.query(ExecutionLog)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ def test_privacy_request_log_failure(
assert sent_event.event == "privacy_request_execution_failure"
assert sent_event.event_created_at is not None

assert sent_event.local_host is False
assert sent_event.local_host is None
assert sent_event.endpoint is None
assert sent_event.status_code == 500
assert sent_event.error == "KeyError"
Expand Down

0 comments on commit 5e937ad

Please sign in to comment.