Skip to content

Commit bc72694

Browse files
authored
ref(arroyo): Arroyo metrics in every Sentry process (#94163)
Initialize arroyo's metrics backend in every sentry process. Due to existing metrics, all arroyo metrics are namespaced under sentry.consumer even though it doesn't make sense for producers.
1 parent 2f4c293 commit bc72694

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

.github/CODEOWNERS

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
/src/sentry/post_process_forwarder/ @getsentry/owners-snuba
1414
/src/sentry/utils/snuba.py @getsentry/owners-snuba @getsentry/visibility
1515
/src/sentry/utils/snql.py @getsentry/owners-snuba
16-
/src/sentry/utils/arroyo.py @getsentry/owners-snuba
17-
/src/sentry/utils/arroyo_producer.py @getsentry/owners-snuba
1816
/src/sentry/tsdb/snuba.py @getsentry/owners-snuba
1917
/src/sentry/tsdb/redissnuba.py @getsentry/owners-snuba
2018
/src/sentry/tagstore/snuba/ @getsentry/owners-snuba
@@ -672,6 +670,10 @@ tests/sentry/api/endpoints/test_organization_dashboard_widget_details.py @ge
672670
/src/sentry/spans/ @getsentry/visibility @getsentry/streaming-platform
673671
/tests/sentry/spans/ @getsentry/visibility @getsentry/streaming-platform
674672

673+
# Streaming platform
674+
/src/sentry/utils/arroyo.py @getsentry/streaming-platform
675+
/src/sentry/utils/arroyo_producer.py @getsentry/streaming-platform
676+
675677
# Workflow engine
676678
/src/sentry/workflow_engine/ @getsentry/alerts-create-issues
677679
/tests/sentry/workflow_engine/ @getsentry/alerts-create-issues

src/sentry/runner/commands/run.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,15 +623,12 @@ def basic_consumer(
623623
"""
624624
from sentry.consumers import get_stream_processor
625625
from sentry.metrics.middleware import add_global_tags
626-
from sentry.utils.arroyo import initialize_arroyo_main
627626

628627
log_level = options.pop("log_level", None)
629628
if log_level is not None:
630629
logging.getLogger("arroyo").setLevel(log_level.upper())
631630

632631
add_global_tags(kafka_topic=topic, consumer_group=options["group_id"])
633-
initialize_arroyo_main()
634-
635632
processor = get_stream_processor(consumer_name, consumer_args, topic=topic, **options)
636633

637634
# for backwards compat: should eventually be removed
@@ -654,9 +651,6 @@ def dev_consumer(consumer_names: tuple[str, ...]) -> None:
654651
"""
655652

656653
from sentry.consumers import get_stream_processor
657-
from sentry.utils.arroyo import initialize_arroyo_main
658-
659-
initialize_arroyo_main()
660654

661655
processors = [
662656
get_stream_processor(

src/sentry/runner/initializer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from sentry.silo.patches.silo_aware_transaction_patch import patch_silo_aware_atomic
1313
from sentry.utils import warnings
14+
from sentry.utils.arroyo import initialize_arroyo_main
1415
from sentry.utils.sdk import configure_sdk
1516
from sentry.utils.warnings import DeprecatedSettingWarning
1617

@@ -387,6 +388,8 @@ def initialize_app(config: dict[str, Any], skip_service_validation: bool = False
387388

388389
import_grouptype()
389390

391+
initialize_arroyo_main()
392+
390393
# Hacky workaround to dynamically set the CSRF_TRUSTED_ORIGINS for self hosted
391394
if settings.SENTRY_SELF_HOSTED and not settings.CSRF_TRUSTED_ORIGINS:
392395
from sentry import options

src/sentry/utils/arroyo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ def initialize_arroyo_main() -> None:
133133

134134
from sentry.utils.metrics import backend
135135

136+
# XXX: we initially called this function only to initialize sentry consumer
137+
# metrics, and namespaced arroyo metrics under sentry.consumer. Now we
138+
# initialize arroyo metrics in every sentry process, and so even producer
139+
# metrics are namespaced under sentry.consumer.
136140
metrics_wrapper = MetricsWrapper(backend, name="consumer")
137141
configure_metrics(metrics_wrapper)
138142

0 commit comments

Comments
 (0)