Sentry logging

Logging for my Sentry server that tracks the values of the serial number, car fingerprint, user set parameters, and the date and time for when FrogPilot was installed and last updated for debugging and support.
This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent bb61ac62a7
commit 6427b1380e
5 changed files with 137 additions and 17 deletions

View File

@@ -13,6 +13,7 @@ from collections import defaultdict
from pathlib import Path
from typing import List, Union, Optional
from markdown_it import MarkdownIt
from zoneinfo import ZoneInfo
from openpilot.common.basedir import BASEDIR
from openpilot.common.params import Params
@@ -410,6 +411,7 @@ class Updater:
finalize_update()
cloudlog.info("finalize success!")
self.params.put("Updated", datetime.datetime.now().astimezone(ZoneInfo('America/Phoenix')).strftime("%B %d, %Y - %I:%M%p").encode('utf8'))
def main() -> None:
params = Params()
@@ -433,9 +435,9 @@ def main() -> None:
if Path(os.path.join(STAGING_ROOT, "old_openpilot")).is_dir():
cloudlog.event("update installed")
if not params.get("InstallDate"):
t = datetime.datetime.utcnow().isoformat()
params.put("InstallDate", t.encode('utf8'))
# Format InstallDate to Phoenix time zone with full date-time
if params.get("InstallDate") is None or params.get("Updated") is None:
params.put("InstallDate", datetime.datetime.now().astimezone(ZoneInfo('America/Phoenix')).strftime("%B %d, %Y - %I:%M%p").encode('utf8'))
updater = Updater()
update_failed_count = 0 # TODO: Load from param?