Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Fix localhost setting for non-endpoint analytics calls [#1029] #1130

Merged
merged 2 commits into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally that it is now possible to make these calls to fideslog after Phil's work here ethyca/fideslog#79

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