From 2b44fb2a449410a64aa4628e06fdd4e1cb1ae6aa Mon Sep 17 00:00:00 2001 From: Mikhail Koniakhin Date: Mon, 30 Sep 2024 09:06:43 +0300 Subject: [PATCH] fix: add topic partition counts in snuba config for correct (#1489) provisioning --- charts/sentry/templates/snuba/_helper-snuba.tpl | 13 +++++++++++++ charts/sentry/values.yaml | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/charts/sentry/templates/snuba/_helper-snuba.tpl b/charts/sentry/templates/snuba/_helper-snuba.tpl index 8cfeb74eb..0f3ee295a 100644 --- a/charts/sentry/templates/snuba/_helper-snuba.tpl +++ b/charts/sentry/templates/snuba/_helper-snuba.tpl @@ -9,6 +9,19 @@ settings.py: | DEBUG = env("DEBUG", "0").lower() in ("1", "true") +{{- if .Values.kafka.enabled -}} + {{ if .Values.kafka.provisioning.enabled }} + + # Set partition counts for provisioning topics from kafka chart. + TOPIC_PARTITION_COUNTS = { + {{- $numPartitions := .Values.kafka.provisioning.numPartitions -}} + {{- range .Values.kafka.provisioning.topics }} + {{ .name | quote }}: {{ default $numPartitions .partitions }}, + {{- end }} + } + {{- end -}} +{{- end }} + # Clickhouse Options CLUSTERS = [ { diff --git a/charts/sentry/values.yaml b/charts/sentry/values.yaml index bd47249ab..e90db2efb 100644 --- a/charts/sentry/values.yaml +++ b/charts/sentry/values.yaml @@ -1925,11 +1925,16 @@ kafka: # Topic list is based on files below. # - https://github.com/getsentry/snuba/blob/master/snuba/utils/streams/topics.py # - https://github.com/getsentry/self-hosted/blob/master/install/create-kafka-topics.sh#L6 + ## Default number of partitions for topics when unspecified + ## + # numPartitions: 1 # Note that snuba component might fail if you set `hooks.snubaInit.kafka.enabled` to `false` and remove the topics from this default topic list. topics: - name: events config: "message.timestamp.type": LogAppendTime + ## Number of partitions for this topic + # partitions: 1 - name: event-replacements - name: snuba-commit-log config: