Kafka consumers

  1. Add the topic to the KAFKA_TOPIC_TO_CLUSTER in src/sentry/conf/server.py:
  • e.g. subscription-results-eap-items
  1. Add the topic to Topic in src/sentry/conf/types/kafka_definition.py

In most cases a Streaming Factory is what you want to when defining a consumer (see next section). You can find examples of it in Sentry's code base.

  1. Add a new entry in the KAFKA_CONSUMERS key in src/sentry/consumers/init.py:
Copied
KAFKA_CONSUMERS = {
    "<your_topic_str_here>": {
        "topic": Topic.YOUR_TOPIC,
        "strategy_factory": "sentry_package_defining_your_strategy_factory_class",
    }
}
  1. You may need optional properties (e.g. click_options, you will need to research them by looking at ConsumerDefinition's code.

  2. Make sure you can run it: sentry run consumer <your_topic>

  3. You may need to add some devserver options here.

  4. Add tests for your consumer

Visit the Ops repo and search for shared_config/kafka/README.md for a full, in-depth step-by-step guide.

Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").