|
23 | 23 | validate_consumer_definition, |
24 | 24 | ) |
25 | 25 | from sentry.consumers.dlq import DlqStaleMessagesStrategyFactoryWrapper, maybe_build_dlq_producer |
| 26 | +from sentry.consumers.profiler import JoinProfiler |
26 | 27 | from sentry.consumers.validate_schema import ValidateSchema |
27 | 28 | from sentry.eventstream.types import EventStreamEventType |
28 | 29 | from sentry.ingest.types import ConsumerType |
@@ -466,6 +467,7 @@ def get_stream_processor( |
466 | 467 | kafka_slice_id: int | None = None, |
467 | 468 | shutdown_strategy_before_consumer: bool = False, |
468 | 469 | add_global_tags: bool = False, |
| 470 | + profile_consumer_join: bool = False, |
469 | 471 | ) -> StreamProcessor: |
470 | 472 | from sentry.utils import kafka_config |
471 | 473 |
|
@@ -594,6 +596,9 @@ def build_consumer_config(group_id: str): |
594 | 596 | healthcheck_file_path, strategy_factory |
595 | 597 | ) |
596 | 598 |
|
| 599 | + if profile_consumer_join: |
| 600 | + strategy_factory = JoinProfilerStrategyFactoryWrapper(strategy_factory) |
| 601 | + |
597 | 602 | if enable_dlq and consumer_definition.get("dlq_topic"): |
598 | 603 | dlq_topic = consumer_definition["dlq_topic"] |
599 | 604 | else: |
@@ -674,3 +679,12 @@ def __init__(self, healthcheck_file_path: str, inner: ProcessingStrategyFactory) |
674 | 679 | def create_with_partitions(self, commit, partitions): |
675 | 680 | rv = self.inner.create_with_partitions(commit, partitions) |
676 | 681 | return Healthcheck(self.healthcheck_file_path, rv) |
| 682 | + |
| 683 | + |
| 684 | +class JoinProfilerStrategyFactoryWrapper(ProcessingStrategyFactory): |
| 685 | + def __init__(self, inner: ProcessingStrategyFactory): |
| 686 | + self.inner = inner |
| 687 | + |
| 688 | + def create_with_partitions(self, commit, partitions): |
| 689 | + rv = self.inner.create_with_partitions(commit, partitions) |
| 690 | + return JoinProfiler(rv) |
0 commit comments