Signed-off-by: Renovate Bot <bot@renovateapp.com>
Airbrake
The Airbrake plugin provides connectivity between Backstage and Airbrake (https://airbrake.io/).
How to use
-
Install the Frontend plugin:
# From your Backstage root directory yarn add --cwd packages/app @backstage/plugin-airbrake -
Install the Backend plugin:
# From your Backstage root directory yarn add --cwd packages/backend @backstage/plugin-airbrake-backend -
Add the
EntityAirbrakeContenttopackages/app/src/components/catalog/EntityPage.tsxfor all the entity pages you want Airbrake to be in:import { EntityAirbrakeContent } from '@backstage/plugin-airbrake'; const serviceEntityPage = ( <EntityLayoutWrapper> <EntityLayout.Route path="/airbrake" title="Airbrake"> <EntityAirbrakeContent /> </EntityLayout.Route> </EntityLayoutWrapper> ); const websiteEntityPage = ( <EntityLayoutWrapper> <EntityLayout.Route path="/airbrake" title="Airbrake"> <EntityAirbrakeContent /> </EntityLayout.Route> </EntityLayoutWrapper> ); const defaultEntityPage = ( <EntityLayoutWrapper> <EntityLayout.Route path="/airbrake" title="Airbrake"> <EntityAirbrakeContent /> </EntityLayout.Route> </EntityLayoutWrapper> ); -
Create
packages/backend/src/plugins/airbrake.tswith these contents:import { Router } from 'express'; import { PluginEnvironment } from '../types'; import { createRouter, extractAirbrakeConfig, } from '@backstage/plugin-airbrake-backend'; export default async function createPlugin( env: PluginEnvironment, ): Promise<Router> { return createRouter({ logger: env.logger, airbrakeConfig: extractAirbrakeConfig(env.config), }); } -
Setup the Backend code in
packages/backend/src/index.ts:import airbrake from './plugins/airbrake'; async function main() { //... After const createEnv = makeCreateEnv(config) ... const airbrakeEnv = useHotMemoize(module, () => createEnv('airbrake')); //... After const apiRouter = Router() ... apiRouter.use('/airbrake', await airbrake(airbrakeEnv)); } -
Add this config as a top level section in your
app-config.yaml:airbrake: apiKey: ${AIRBRAKE_API_KEY} -
Set an environment variable
AIRBRAKE_API_KEYwith your API key before starting Backstage backend. -
Add the following annotation to the
catalog-info.yamlfor a repo you want to link to an Airbrake project:metadata: annotations: airbrake.io/project-id: '123456'
Local Development
Start this plugin in standalone mode by running yarn start inside the plugin directory. This method of serving the plugin provides quicker
iteration speed and a faster startup and hot reloads. It is only meant for local development, and the setup for it can
be found inside the /dev directory.
A mock API will be used to run it in standalone. If you want to talk to the real API follow the instructions to start up Airbrake Backend in standalone.