mirror of https://github.com/commaai/openpilot.git
logging: make swaglog context match in python and c (#31288)
* logging: make swaglog context match in python and c
* add git context to athenad
old-commit-hash: d0a1fa636a
This commit is contained in:
parent
14e12980f5
commit
94b3f2d22a
|
@ -41,6 +41,15 @@ public:
|
|||
if (char* dongle_id = getenv("DONGLE_ID")) {
|
||||
ctx_j["dongle_id"] = dongle_id;
|
||||
}
|
||||
if (char* git_origin = getenv("GIT_ORIGIN")) {
|
||||
ctx_j["origin"] = git_origin;
|
||||
}
|
||||
if (char* git_branch = getenv("GIT_BRANCH")) {
|
||||
ctx_j["branch"] = git_branch;
|
||||
}
|
||||
if (char* git_commit = getenv("GIT_COMMIT")) {
|
||||
ctx_j["commit"] = git_commit;
|
||||
}
|
||||
if (char* daemon_name = getenv("MANAGER_DAEMON")) {
|
||||
ctx_j["daemon"] = daemon_name;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ from multiprocessing import Process
|
|||
from openpilot.common.params import Params
|
||||
from openpilot.selfdrive.manager.process import launcher
|
||||
from openpilot.common.swaglog import cloudlog
|
||||
from openpilot.system.version import get_version, is_dirty
|
||||
from openpilot.system.hardware import HARDWARE
|
||||
from openpilot.system.version import get_version, get_normalized_origin, get_short_branch, get_commit, is_dirty
|
||||
|
||||
ATHENA_MGR_PID_PARAM = "AthenadPid"
|
||||
|
||||
|
@ -14,7 +15,13 @@ ATHENA_MGR_PID_PARAM = "AthenadPid"
|
|||
def main():
|
||||
params = Params()
|
||||
dongle_id = params.get("DongleId").decode('utf-8')
|
||||
cloudlog.bind_global(dongle_id=dongle_id, version=get_version(), dirty=is_dirty())
|
||||
cloudlog.bind_global(dongle_id=dongle_id,
|
||||
version=get_version(),
|
||||
origin=get_normalized_origin(),
|
||||
branch=get_short_branch(),
|
||||
commit=get_commit(),
|
||||
dirty=is_dirty(),
|
||||
device=HARDWARE.get_device_type())
|
||||
|
||||
try:
|
||||
while 1:
|
||||
|
|
|
@ -79,6 +79,9 @@ def manager_init() -> None:
|
|||
serial = params.get("HardwareSerial")
|
||||
raise Exception(f"Registration failed for device {serial}")
|
||||
os.environ['DONGLE_ID'] = dongle_id # Needed for swaglog
|
||||
os.environ['GIT_ORIGIN'] = get_normalized_origin() # Needed for swaglog
|
||||
os.environ['GIT_BRANCH'] = get_short_branch() # Needed for swaglog
|
||||
os.environ['GIT_COMMIT'] = get_commit() # Needed for swaglog
|
||||
|
||||
if not is_dirty():
|
||||
os.environ['CLEAN'] = '1'
|
||||
|
|
Loading…
Reference in New Issue