Sentry: sets environment tag (#605)

* Sentry: sets environment tag

* master channel

---------

Co-authored-by: DevTekVE <devtekve@gmail.com>
This commit is contained in:
Jason Wen
2025-01-22 15:05:10 -05:00
committed by GitHub
parent 3e7240516e
commit f1837b8502
2 changed files with 23 additions and 7 deletions
+1 -5
View File
@@ -116,12 +116,8 @@ def get_properties() -> tuple[str, str, str]:
def init(project: SentryProject) -> bool:
build_metadata = get_build_metadata()
# forks like to mess with this, so double check
# comma_remote = build_metadata.openpilot.comma_remote and "commaai" in build_metadata.openpilot.git_origin
# if not comma_remote or not is_registered_device() or PC:
# return False
env = "release" if build_metadata.tested_channel else "master"
env = build_metadata.channel_type
dongle_id, git_username, sunnylink_dongle_id = get_properties()
integrations = []
+22 -2
View File
@@ -10,8 +10,11 @@ from openpilot.common.basedir import BASEDIR
from openpilot.common.swaglog import cloudlog
from openpilot.common.git import get_commit, get_origin, get_branch, get_short_branch, get_commit_date
RELEASE_BRANCHES = ['release3-staging', 'release3', 'nightly']
TESTED_BRANCHES = RELEASE_BRANCHES + ['devel', 'devel-staging', 'nightly-dev']
RELEASE_SP_BRANCHES = ['release-c3']
TESTED_SP_BRANCHES = ['staging-c3', 'staging-c3-new']
MASTER_SP_BRANCHES = ['master', 'master-new']
RELEASE_BRANCHES = ['release3-staging', 'release3', 'nightly'] + RELEASE_SP_BRANCHES
TESTED_BRANCHES = RELEASE_BRANCHES + ['devel', 'devel-staging', 'nightly-dev'] + TESTED_SP_BRANCHES
BUILD_METADATA_FILENAME = "build.json"
@@ -110,6 +113,23 @@ class BuildMetadata:
def ui_description(self) -> str:
return f"{self.openpilot.version} / {self.openpilot.git_commit[:6]} / {self.channel}"
@property
def master_channel(self) -> bool:
return self.channel in MASTER_SP_BRANCHES
@property
def channel_type(self) -> str:
if self.channel.startswith("dev-"):
return "development"
elif self.channel.startswith("staging-"):
return "staging"
elif self.master_channel:
return "master"
elif self.tested_channel:
return "release"
else:
return "feature"
def build_metadata_from_dict(build_metadata: dict) -> BuildMetadata:
channel = build_metadata.get("channel", "unknown")