Skip to content

Commit

Permalink
dev(releases): add telemetry for set_commits (#76765)
Browse files Browse the repository at this point in the history
adds tracing telemetry to set_commits function and sets metrics sample
rate to 1.0 to ensure we catch outliers in our metrics.
  • Loading branch information
JoshFerge authored Sep 3, 2024
1 parent 20d50c7 commit 9fc36f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/sentry/models/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,15 @@ def set_refs(self, refs, user_id, fetch=False):
}
)

@sentry_sdk.trace
def set_commits(self, commit_list):
"""
Bind a list of commits to this release.
This will clear any existing commit log and replace it with the given
commits.
"""
sentry_sdk.set_measurement("release.set_commits", len(commit_list))

# Sort commit list in reverse order
commit_list.sort(key=lambda commit: commit.get("timestamp", 0), reverse=True)
Expand Down Expand Up @@ -821,7 +823,7 @@ def set_commits(self, commit_list):
],
last_commit_id=latest_commit.id if latest_commit else None,
)
metrics.timing("release.set_commits.duration", time() - start)
metrics.timing("release.set_commits.duration", time() - start, sample_rate=1.0)

# fill any missing ReleaseHeadCommit entries
for repo_id, commit_id in head_commit_by_repo.items():
Expand Down

0 comments on commit 9fc36f7

Please sign in to comment.