Skip to content

Commit

Permalink
Log usage of niche features (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem authored Nov 14, 2024
1 parent b3f5e8d commit 20861f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions services/report/raw_upload_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ def clear_carryforward_sessions(
if to_partially_overwrite_flags:
# NOTE: this here might be the most accurate counter, as it takes into account the
# actual `to_merge_flags` that were used for this particular upload.
sentry_sdk.capture_message(
"Customer is using `carryforward_mode=labels` feature",
extras={"flags": to_partially_overwrite_flags},
)
LABELS_USAGE.labels(codepath="carryforward_cleanup").inc()

to_fully_overwrite_flags = flags_under_carryforward_rules.difference(
Expand Down
15 changes: 9 additions & 6 deletions tasks/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def __init__(
repoid: int,
commitid: str,
report_type: ReportType = ReportType.COVERAGE,
report_code: Optional[str] = None,
redis_connection: Optional[Redis] = None,
report_code: str | None = None,
redis_connection: Redis | None = None,
):
self.repoid = repoid
self.commitid = commitid
Expand All @@ -89,8 +89,6 @@ def __init__(

def log_extra(self, **kwargs) -> dict:
return dict(
repoid=self.repoid,
commit=self.commitid,
report_type=self.report_type.value,
report_code=self.report_code,
**kwargs,
Expand Down Expand Up @@ -286,8 +284,8 @@ def run_impl(
db_session: Session,
repoid: int,
commitid: str,
report_type="coverage",
report_code=None,
report_type: str = "coverage",
report_code: str | None = None,
*args,
**kwargs,
):
Expand All @@ -297,6 +295,11 @@ def run_impl(
report_type=ReportType(report_type),
report_code=report_code,
)
if report_code:
sentry_sdk.capture_message(
"Customer is using non-default `report_code`",
tags={"report_type": report_type, "report_code": report_code},
)
checkpoints = upload_context.get_checkpoints(kwargs)
log.info("Received upload task", extra=upload_context.log_extra())

Expand Down

0 comments on commit 20861f4

Please sign in to comment.