From f8e95ec8686f23a4ed14d413599d3169e5beb165 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Tue, 4 Jun 2024 10:35:30 -0700 Subject: [PATCH] feat: Add crons task consumers (#3106) We now process tasks via Kafka consumers instead of celerybeat. This needs to be added to self-hosted as well --- docker-compose.yml | 6 ++++++ install/create-kafka-topics.sh | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 9c4774e224..84fb56da79 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -384,6 +384,12 @@ services: ingest-monitors: <<: *sentry_defaults command: run consumer --no-strict-offset-reset ingest-monitors --consumer-group ingest-monitors + monitors-clock-tick: + <<: *sentry_defaults + command: run consumer --no-strict-offset-reset monitors-clock-tick --consumer-group monitors-clock-tick + monitors-clock-tasks: + <<: *sentry_defaults + command: run consumer --no-strict-offset-reset monitors-clock-tasks --consumer-group monitors-clock-tasks post-process-forwarder-errors: <<: *sentry_defaults command: run consumer post-process-forwarder-errors --consumer-group post-process-forwarder --synchronize-commit-log-topic=snuba-commit-log --synchronize-commit-group=snuba-consumers diff --git a/install/create-kafka-topics.sh b/install/create-kafka-topics.sh index 63e0cffa01..ff2ba8e660 100644 --- a/install/create-kafka-topics.sh +++ b/install/create-kafka-topics.sh @@ -14,7 +14,7 @@ done # XXX(BYK): We cannot use auto.create.topics as Confluence and Apache hates it now (and makes it very hard to enable) EXISTING_KAFKA_TOPICS=$($dc exec -T kafka kafka-topics --list --bootstrap-server kafka:9092 2>/dev/null) -NEEDED_KAFKA_TOPICS="ingest-attachments ingest-transactions ingest-events ingest-replay-recordings profiles ingest-occurrences ingest-metrics ingest-performance-metrics ingest-monitors" +NEEDED_KAFKA_TOPICS="ingest-attachments ingest-transactions ingest-events ingest-replay-recordings profiles ingest-occurrences ingest-metrics ingest-performance-metrics ingest-monitors monitors-clock-tasks" for topic in $NEEDED_KAFKA_TOPICS; do if ! echo "$EXISTING_KAFKA_TOPICS" | grep -qE "(^| )$topic( |$)"; then $dc exec kafka kafka-topics --create --topic $topic --bootstrap-server kafka:9092 @@ -22,4 +22,11 @@ for topic in $NEEDED_KAFKA_TOPICS; do fi done +# This topic must have only a single partition for the consumer to work correctly +# https://github.com/getsentry/ops/blob/7dbc26f39c584ec924c8fef2ad5c532d6a158be3/k8s/clusters/us/_topicctl.yaml#L288-L295 + +if ! echo "$EXISTING_KAFKA_TOPICS" | grep -qE "(^| )monitors-clock-tick( |$)"; then + $dc exec kafka kafka-topics --create --topic monitors-clock-tick --bootstrap-server kafka:9092 --partitions 1 +fi + echo "${_endgroup}"