Skip to content

Commit

Permalink
add commit sha to sentry trace tags (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed May 28, 2024
1 parent b75115d commit 5285a97
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tasks/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
from datetime import datetime

import sentry_sdk
from celery.exceptions import SoftTimeLimitExceeded
from celery.worker.request import Request
from django.db import transaction as django_transaction
Expand Down Expand Up @@ -253,8 +254,12 @@ def run(self, *args, **kwargs):
self.task_run_counter.inc()
self._emit_queue_metrics()

commit_sha = kwargs.get("commitid")
if commit_sha:
sentry_sdk.set_tag("commit_sha", commit_sha)

metric_context = MetricContext(
commit_sha=kwargs.get("commitid"),
commit_sha=commit_sha,
repo_id=kwargs.get("repoid"),
owner_id=kwargs.get("ownerid"),
)
Expand Down

0 comments on commit 5285a97

Please sign in to comment.