Browse Source

sample-event: try synchronous kafka producing (#54748)

- when creating a sample event, try producing synchronously, since when
done through the sample_event
[endpoint](https://github.com/getsentry/sentry/blob/7e204dc42b2dd671aec955f108ea334dea72339e/src/sentry/api/endpoints/project_create_sample.py#L19),
we may not finish flushing before the request thread is terminated.
- can test this on S4S to see if fixes issue, and quickly revert before
it makes it to canary before it can cause problems, but I think it
should be fine?


Note: my understanding of kafka / how Django uWSGI lifecycles work is
not expert, so my analysis/assumptions here may be off.
Josh Ferge 1 year ago
parent
commit
af9140321a
2 changed files with 3 additions and 0 deletions
  1. 2 0
      src/sentry/eventstream/kafka/backend.py
  2. 1 0
      src/sentry/eventstream/snuba.py

+ 2 - 0
src/sentry/eventstream/kafka/backend.py

@@ -161,6 +161,8 @@ class KafkaEventStream(SnubaProtocolEventStream):
                     "sample_event": True,
                 },
             )
+            kwargs["asynchronous"] = False
+
         super().insert(
             event,
             is_new,

+ 1 - 0
src/sentry/eventstream/snuba.py

@@ -215,6 +215,7 @@ class SnubaProtocolEventStream(EventStream):
                 },
             ),
             headers=headers,
+            asynchronous=kwargs.get("asynchronous", True),
             skip_semantic_partitioning=skip_semantic_partitioning,
             event_type=event_type,
         )