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

  1. Discuss it with SRE during their office hours
  2. Create ops PR for adding your consumer to k8s/services/getsentry/_consumer-deployment.yaml.j2.
  3. In the Sentry Consumers metrics dashboard, add a new saved view for your consumer.
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").