Skip to content
Merged
Changes from all 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
23 changes: 16 additions & 7 deletions src/sentry/data_export/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,13 @@ def export_data_to_stored_blobs_sync(
"requested_rows": export_limit,
}
sentry_sdk.set_tag("download_type", "sync")
sentry_sdk.set_attribute("download_type", "sync")
sentry_sdk.set_context("data_export", extra)
sentry_sdk.set_attribute("data_export.data_export_id", data_export.id)
sentry_sdk.set_attribute("data_export.query", str(data_export.payload))
sentry_sdk.set_attribute("data_export.organization_id", data_export.organization_id)
sentry_sdk.set_attribute("data_export.download_type", "sync")
sentry_sdk.set_attribute("data_export.requested_rows", export_limit)
_set_data_on_scope(data_export)
with sentry_sdk.start_span(op="assemble", name="Sync Export Data"):
logger.info("dataexport.start", extra=extra)
Expand Down Expand Up @@ -853,14 +859,17 @@ def merge_export_blobs(


def _set_data_on_scope(data_export: ExportedData) -> None:
scope = sentry_sdk.get_isolation_scope()
if data_export.user_id:
user = dict(id=data_export.user_id)
scope.set_user(user)
scope.set_tag("organization.slug", data_export.organization.slug)
scope.set_tag("export.type", ExportQueryType.as_str(data_export.query_type))
scope.set_tag("export.format", data_export.export_format)
sentry_sdk.set_user(user)
sentry_sdk.set_tag("organization.slug", data_export.organization.slug)
sentry_sdk.set_attribute("organization.slug", data_export.organization.slug)
sentry_sdk.set_tag("export.type", ExportQueryType.as_str(data_export.query_type))
sentry_sdk.set_attribute("export.type", ExportQueryType.as_str(data_export.query_type))
sentry_sdk.set_tag("export.format", data_export.export_format)
sentry_sdk.set_attribute("export.format", data_export.export_format)
qi = data_export.query_info
if qi.get("dataset") is not None:
scope.set_tag("export.dataset", str(qi.get("dataset")))
scope.set_extra("export.query", data_export.query_info)
sentry_sdk.set_tag("export.dataset", str(qi.get("dataset")))
sentry_sdk.set_attribute("export.dataset", str(qi.get("dataset")))
sentry_sdk.set_extra("export.query", data_export.query_info)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this extra need to be set as an attribute as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it there originally but then Warden was complaining about stringifying the query and potentially including user data, so opted to not migrate this one.

Loading