@backstage-community/plugin-kafka
TypeScript icon, indicating that this package has built-in type declarations

0.6.1 • Public • Published

Kafka Plugin

Setup

  1. Run:
# From your Backstage root directory
yarn --cwd packages/app add @backstage-community/plugin-kafka
yarn --cwd packages/backend add @backstage-community/plugin-kafka-backend
  1. Add the plugin backend:

In a new file named kafka.ts under backend/src/plugins:

import { createRouter } from '@backstage-community/plugin-kafka-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';

export default async function createPlugin(
  env: PluginEnvironment,
): Promise<Router> {
  return await createRouter({
    logger: env.logger,
    config: env.config,
  });
}

And then add to packages/backend/src/index.ts:

// In packages/backend/src/index.ts
import kafka from './plugins/kafka';
// ...
async function main() {
  // ...
  const kafkaEnv = useHotMemoize(module, () => createEnv('kafka'));
  // ...
  apiRouter.use('/kafka', await kafka(kafkaEnv));
  1. Add the plugin as a tab to your service entities:
// In packages/app/src/components/catalog/EntityPage.tsx
import { EntityKafkaContent } from '@backstage-community/plugin-kafka';

const serviceEntityPage = (
  <EntityLayout>
    {/* other tabs... */}
    <EntityLayout.Route path="/kafka" title="Kafka">
      <EntityKafkaContent />
    </EntityLayout.Route>
  1. Add broker configs for the backend in your app-config.yaml (see kafka-backend for more options):
kafka:
  clientId: backstage
  clusters:
    - name: cluster-name
      brokers:
        - localhost:9092
  1. Add the kafka.apache.org/consumer-groups annotation to your services:

Can be a comma separated list.

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  # ...
  annotations:
    kafka.apache.org/consumer-groups: cluster-name/consumer-group-name
spec:
  type: service
  1. Configure dashboard urls:

You have two options.
Either configure it with an annotation called kafka.apache.org/dashboard-urls

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  # ...
  annotations:
    kafka.apache.org/dashboard-urls: cluster-name/consumer-group-name/dashboard-url
spec:
  type: service

The consumer-group-name is optional.

or with configs in app-config.yaml

kafka:
  # ...
  clusters:
    - name: cluster-name
      dashboardUrl: https://dashboard.com

Features

  • List topics offsets and consumer group offsets for configured services.

Readme

Keywords

none

Package Sidebar

Install

npm i @backstage-community/plugin-kafka

Homepage

backstage.io

Weekly Downloads

1,455

Version

0.6.1

License

Apache-2.0

Unpacked Size

87.4 kB

Total Files

25

Last publish

Collaborators

  • patriko