Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: record if transactions ever have plugin tags #79787

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/sentry/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def save_error_events(
except ProjectKey.DoesNotExist:
pass

_derive_plugin_tags_many(jobs, projects)
_derive_plugin_tags_many(jobs, projects, True)
lynnagara marked this conversation as resolved.
Show resolved Hide resolved
_derive_interface_tags_many(jobs)

# Load attachments first, but persist them at the very last after
Expand Down Expand Up @@ -829,14 +829,21 @@ def _get_event_user_many(jobs: Sequence[Job], projects: ProjectsMapping) -> None


@sentry_sdk.tracing.trace
def _derive_plugin_tags_many(jobs: Sequence[Job], projects: ProjectsMapping) -> None:
def _derive_plugin_tags_many(
jobs: Sequence[Job], projects: ProjectsMapping, is_transaction: bool = False
) -> None:
# XXX: We ought to inline or remove this one for sure
plugins_for_projects = {p.id: plugins.for_project(p, version=None) for p in projects.values()}

for job in jobs:
for plugin in plugins_for_projects[job["project_id"]]:
added_tags = safe_execute(plugin.get_tags, job["event"])

if added_tags:
# XXX: Temporarily record if any transactions actually have added tags, in order to
# determine whether this can be safely removed. This metric should be removed once validated.
if is_transaction:
metrics.incr("save_transaction_events.has_added_tags")
data = job["data"]
# plugins should not override user provided tags
for key, value in added_tags:
Expand Down
Loading