File tree Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Expand file tree Collapse file tree 3 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -414,12 +414,13 @@ def devserver(
414
414
"""
415
415
)
416
416
417
- from sentry .conf .types .kafka_definition import Topic
417
+ from sentry_kafka_schemas import list_topics
418
+
418
419
from sentry .utils .batching_kafka_consumer import create_topics
419
- from sentry .utils .kafka_config import get_topic_definition
420
+ from sentry .utils .kafka_config import get_topic_definition_from_name
420
421
421
- for topic in Topic :
422
- topic_defn = get_topic_definition (topic )
422
+ for topic in list_topics () :
423
+ topic_defn = get_topic_definition_from_name (topic )
423
424
create_topics (topic_defn ["cluster" ], [topic_defn ["real_topic_name" ]])
424
425
425
426
if dev_consumer :
Original file line number Diff line number Diff line change @@ -83,12 +83,13 @@ def _upgrade(
83
83
nodestore .backend .bootstrap ()
84
84
85
85
if create_kafka_topics :
86
- from sentry .conf .types .kafka_definition import Topic
86
+ from sentry_kafka_schemas import list_topics
87
+
87
88
from sentry .utils .batching_kafka_consumer import create_topics
88
- from sentry .utils .kafka_config import get_topic_definition
89
+ from sentry .utils .kafka_config import get_topic_definition_from_name
89
90
90
- for topic in Topic :
91
- topic_defn = get_topic_definition (topic )
91
+ for topic in list_topics () :
92
+ topic_defn = get_topic_definition_from_name (topic )
92
93
create_topics (topic_defn ["cluster" ], [topic_defn ["real_topic_name" ]])
93
94
94
95
if repair :
Original file line number Diff line number Diff line change @@ -102,3 +102,10 @@ def get_topic_definition(topic: Topic) -> TopicDefinition:
102
102
"cluster" : settings .KAFKA_TOPIC_TO_CLUSTER [topic .value ],
103
103
"real_topic_name" : settings .KAFKA_TOPIC_OVERRIDES .get (topic .value , topic .value ),
104
104
}
105
+
106
+
107
+ def get_topic_definition_from_name (topic_name : str ) -> TopicDefinition :
108
+ return {
109
+ "cluster" : settings .KAFKA_TOPIC_TO_CLUSTER .get (topic_name , "default" ),
110
+ "real_topic_name" : settings .KAFKA_TOPIC_OVERRIDES .get (topic_name , topic_name ),
111
+ }
You can’t perform that action at this time.
0 commit comments