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(ingest): more telemetry in event consumer #79206

Merged
merged 3 commits into from
Oct 17, 2024
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
10 changes: 8 additions & 2 deletions src/sentry/ingest/consumer/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ def process_event(
with sentry_sdk.start_span(op="orjson.loads"):
data = orjson.loads(payload)

sentry_sdk.set_extra("event_type", data.get("type"))

if project_id == settings.SENTRY_PROJECT:
metrics.incr(
"internal.captured.ingest_consumer.parsed",
Expand Down Expand Up @@ -272,10 +274,14 @@ def process_event(
)

# remember for an 1 hour that we saved this event (deduplication protection)
cache.set(deduplication_key, "", CACHE_TIMEOUT)
with sentry_sdk.start_span(op="cache.set"):
cache.set(deduplication_key, "", CACHE_TIMEOUT)

# emit event_accepted once everything is done
event_accepted.send_robust(ip=remote_addr, data=data, project=project, sender=process_event)
with sentry_sdk.start_span(op="event_accepted.send_robust"):
event_accepted.send_robust(
ip=remote_addr, data=data, project=project, sender=process_event
)
except Exception as exc:
if isinstance(exc, KeyError): # ex: missing event_id in message["payload"]
raise
Expand Down
Loading