Fix sentry resoluton messages (#2295)

This commit is contained in:
Pascal Vizeli 2020-11-24 14:17:47 +01:00 committed by GitHub
parent 84294f286f
commit 056926242f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -74,8 +74,10 @@ def filter_data(coresys: CoreSys, event: dict, hint: dict) -> dict:
"os": coresys.hassos.version,
"supervisor": coresys.supervisor.version,
},
"issues": [attr.asdict(issue) for issue in coresys.resolution.issues],
"unhealthy": coresys.resolution.unhealthy,
"resolution": {
"issues": [attr.asdict(issue) for issue in coresys.resolution.issues],
"unhealthy": coresys.resolution.unhealthy,
},
}
)
event.setdefault("tags", []).extend(

View File

@ -119,9 +119,9 @@ def test_issues_on_report(coresys):
with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))):
event = filter_data(coresys, SAMPLE_EVENT, {})
assert "issues" in event["contexts"]
assert event["contexts"]["issues"][0]["type"] == IssueType.FATAL_ERROR
assert event["contexts"]["issues"][0]["context"] == ContextType.SYSTEM
assert "issues" in event["contexts"]["resolution"]
assert event["contexts"]["resolution"]["issues"][0]["type"] == IssueType.FATAL_ERROR
assert event["contexts"]["resolution"]["issues"][0]["context"] == ContextType.SYSTEM
def test_unhealthy_on_report(coresys):
@ -134,5 +134,5 @@ def test_unhealthy_on_report(coresys):
with patch("shutil.disk_usage", return_value=(42, 42, 2 * (1024.0 ** 3))):
event = filter_data(coresys, SAMPLE_EVENT, {})
assert "issues" in event["contexts"]
assert event["contexts"]["unhealthy"][-1] == UnhealthyReason.DOCKER
assert "issues" in event["contexts"]["resolution"]
assert event["contexts"]["resolution"]["unhealthy"][-1] == UnhealthyReason.DOCKER