Skip to content

Commit

Permalink
use a more descriptive error message when kafka is not running with d…
Browse files Browse the repository at this point in the history
…evserver
  • Loading branch information
hubertdeng123 committed Dec 11, 2024
1 parent ef9534e commit e81df2d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/sentry/runner/commands/devserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,16 @@ def devserver(

# Create all topics if the Kafka eventstream is selected
if kafka_consumers:
kafka_container_name = (
"kafka-kafka-1" if os.environ.get("USE_NEW_DEVSERVICES") == "1" else "sentry_kafka"
use_new_devservices = os.environ.get("USE_NEW_DEVSERVICES") == "1"
kafka_container_name = "kafka-kafka-1" if use_new_devservices else "sentry_kafka"
kafka_container_warning_message = (
f"""
Devserver is configured to work with the revamped devservices. Looks like the `{kafka_container_name}` container is not running.
Please run `devservices up` to start it. If you would like to use devserver with `sentry devservices`, set `USE_NEW_DEVSERVICES=0` in your environment."""
if use_new_devservices
else f"""
Devserver is configured to work with `sentry devservices`. Looks like the `{kafka_container_name}` container is not running.
Please run `sentry devservices up kafka` to start it. If you would like to use devserver with the revamped devservices, set `USE_NEW_DEVSERVICES=1` in your environment."""
)
if kafka_container_name not in containers:
raise click.ClickException(
Expand All @@ -373,7 +381,7 @@ def devserver(
SENTRY_EVENTSTREAM = "sentry.eventstream.kafka.KafkaEventStream"
and run `sentry devservices up kafka`.
{kafka_container_warning_message}
Alternatively, run without --workers.
"""
Expand Down

0 comments on commit e81df2d

Please sign in to comment.