Giter Site home page Giter Site logo

pagerduty / backstage-plugin-backend Goto Github PK

View Code? Open in Web Editor NEW
3.0 6.0 4.0 37.58 MB

PagerDuty plugin for Backstage - Backend

Home Page: https://pagerduty.github.io/backstage-plugin-docs/index.html

License: Apache License 2.0

JavaScript 0.07% TypeScript 99.93%

backstage-plugin-backend's Introduction

PagerDuty plugin for Backstage - Backend

Release npm version License

Bring the power of PagerDuty to Backstage! The PagerDuty backend plugin reduces the cognitive load on developers responsible for maintaining services in production. Instead of having to go to PagerDuty's console, you can now access the necessary information directly within Backstage. This includes finding active incidents or opening a new incident, reviewing recent changes made to the service, and checking who is on-call.

The PagerDuty backend plugin augments the capabilities of the PagerDuty frontend plugin by improving security and enabling PagerDuty a standardization through easy configuration.

Features

  • REST APIs The backend is responsible for all requests to PagerDuty REST APIs. Centralizing these in the backend plugin allows us to only expose the information the frontend needs and therefore improve security and performance.

Getting Started

Find the complete project's documentation here.

Installation

The installation of the PagerDuty plugin for Backstage is done with yarn as all other plugins in Backstage. This plugin follows a modular approach which means that every individual component will be a separate package (e.g. frontend, backend, common). In this case, you are installing a backend plugin.

To install this plugin run the following command from the Backstage root folder.

yarn add --cwd packages/backend @pagerduty/backstage-plugin-backend @pagerduty/backstage-plugin-common

Configuration

To use the backend plugin follow the instructions on the Add the backend plugin to your application section of the project's documentation here.

Support

If you need help with this plugin, please open an issue in GitHub, reach out on the Backstage Discord server or PagerDuty's community forum.

Contributing

If you are interested in contributing to this project, please refer to our Contributing Guidelines.

Contributors of PagerDuty/backstage-plugin-backend

backstage-plugin-backend's People

Contributors

t1agob avatar dependabot[bot] avatar alecjacobs5401 avatar brianphillips avatar pcgqueiroz avatar

Stargazers

micnncim avatar Lukas M avatar  avatar

Watchers

 avatar  avatar Joe Pettit avatar Drew Bruton avatar Christopher Box avatar  avatar

backstage-plugin-backend's Issues

Add support for event noise reduction capabilities

Is your feature request related to a problem? Please describe.
In the current implementation, the Service created in PagerDuty through the Scaffolder action doesn't allow users to configure any options related to event grouping or noise reduction. Therefore, it requires one additional step on the PagerDuty console to enable it.

Describe the solution you'd like
I would like this to be configurable from the Scaffolder. Either by providing options on-screen to choose the event grouping strategy or passing it as a parameter directly on the template.

Describe alternatives you've considered
The only option now is to configure the service in PagerDuty after creating it on Backstage.

Calls to the backend API hangs forever

Describe the bug
The PagerDuty card never loads because the call from the frontend to the backend plugin API hangs forever.
With some debugs, I could find out that the code hangs on the fetch function call.

To Reproduce
I am behind a corporate proxy, maybe that's the reason why.

Expected behavior
The fetch function should return.

Solution
I have imported the fetch function from node-fetch package as recommended by the Backstage team in ADR013: Proper use of HTTP fetching libraries and it solved the bug.

In file pagerduty.ts, I have just added these following lines:

import fetch from 'node-fetch';
import type { RequestInit, Response } from 'node-fetch';

The node-fetch package is already imported in the package.json file: https://github.com/PagerDuty/backstage-plugin-backend/blob/main/package.json#L34

Move API requests to backend plugin

Is your feature request related to a problem? Please describe.
Currently all frontend API requests go directly to PagerDuty APIs by leveraging Backstage proxy component. This simplifies interactions with PagerDuty APIs but also exposes information we don't need.

For added security and performance reasons we have started work on the frontend plugin to remove the proxy dependency (PagerDuty/backstage-plugin#37).

Describe the solution you'd like
Create API endpoints in the backend plugin that expose only the information that the frontend plugin requires. All requests should go through the backend plugin instead of the proxy.

Describe alternatives you've considered
Currently we can only leverage the proxy unless APIs are implemented in the backend plugin.

Add support for configuring other integrations in the scaffolder

Is your feature request related to a problem? Please describe.
Currently the PagerDuty plugin for Backstage provides a custom scaffolder action to create a PagerDuty service which creates the integration to PagerDuty but doesn't allow the configuration of other integrations.

Describe the solution you'd like
I would like to be able to select a list of integrations that I can setup directly from the project template (e.g. create GitHub integration so I can grab the Integration Key and use it in the software template as part of GitHub actions config to capture GitHub changes automatically).

This can be an additional step, or as part of the service creation step.

Describe alternatives you've considered
The is no way to do this from the plugin. These configurations need to be done as an additional step after the service is created.

The template parameter example isn't working

Describe the bug

The example provided in https://pagerduty.github.io/backstage-plugin-docs/advanced/create-service-software-template/ doesn't work even after having followed the provided instructions to setup the plugin: the escalation_policy_id displays an error.

When using the suggested configuration

        escalation_policy_id:
          title: Escalation Policy ID
          type: string
          description: The ID of the escalation policy to associate with the service
          ui:field: SelectFieldFromApi 
          ui:options: 
            title: PagerDuty Escalation Policy
            description: Select an escalation policy from PagerDuty
            path: 'pagerduty/escalation_policies' 
            labelSelector: 'label'
            valueSelector: 'value'
            placeholder: '---'

The software template invokes the endpoint <backstagehost>/pagerduty/escalation_policies which returns a 404 and therefore prevent the field from rendering the escalation policies.

I tried to update the configuration to use the proxy path instead and the policies gets listed but it requires setting arraySelector option and changing labelSelector and valueSelector, working config:

    - title: PagerDuty
      properties:
        escalation_policy_id:
          title: Escalation Policy ID
          type: string
          description: The ID of the escalation policy to associate with the service
          ui:field: SelectFieldFromApi 
          ui:options: 
            title: PagerDuty Escalation Policy
            description: Select an escalation policy from PagerDuty
            path: 'proxy/pagerduty/escalation_policies' 
            labelSelector: 'name'
            valueSelector: 'id'
            placeholder: '---'
            arraySelector: 'escalation_policies'

The pagerduty configuration in app-config for Backstage is as follow:

proxy:
  '/pagerduty':
    target: https://api.pagerduty.com
    headers:
      Authorization: Token token=${PAGERDUTY_TOKEN}
    allowedMethods: ['GET']

pagerDuty:
  apiToken: ${PAGERDUTY_TOKEN}

Allow the plugin to start if credentials are not present

Is your feature request related to a problem? Please describe.
In the latest release of the PagerDuty plugin if the API token or OAuth configuration are not provided the plugin fails and prevents Backstage from starting.

Describe the solution you'd like
For non-production environments I don't want to configure real credentials if I'm not using/testing the PagerDuty plugin. I would like to propose a change this behaviour and allow Backstage to start and instead log an error message and show that the credentials are missing in the PagerDuty Card.

Describe alternatives you've considered
The only alternative now is to configure credentials to prevent Backstage from not starting.

This issue has been reported by @jerroydmoore

On-call shows individual that is N levels down from the first level of the escalation policy

Describe the bug
When migrating from the old version of the plugin (from @backstage/plugin-pagerduty to @pagerduty/backstage-plugin and friends), the list of "On Call" individuals is incorrect. Only a single entry is shown and that individual is not the first level of on call in the relevant escalation policy (at least in the applications I've spot checked after the upgrade in my local environment).

To Reproduce
Steps to reproduce the behavior:

  1. Go to Backstage entity screen with a pagerduty.com/integration-key annotation
  2. Select tab with PagerDuty card
  3. Note the names listed in the "ON CALL" section
  4. Click the "ESCALATION POLICY" button
  5. Compare list of names shown on the pagerduty side (they're different)

Expected behavior
List of individuals that are on call should match

Screenshots

Here you can see that the individual on the fifth level of the escalation policy is the only entry shown:
image

With the old version of the plugin, we correctly see all levels of the escalation policy:
image

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser Chrome
  • Version 121

Additional context

I have tried using the API token-based auth (which we were using with the old version of the plugin) as well as the OAuth version and am observing identical results

Custom scaffolder action to allow service integrations to third party services

Is your feature request related to a problem? Please describe.
The problem that I am trying to solve is of new service onboarding, i.e. when a new service gets created, I want to create a new PD service for it based on the PD team provided by user input.

Describe the solution you'd like
Create scaffolder action to create integrations on a PagerDuty Service from Backstage:

  • pagerduty:integrate:*- which integrates the pagerduty service with the other third party services like Datadog, signalFX

Additional context
Original issue raised by @Alok650 in PagerDuty/backstage-plugin#35. Broken down into two issues to reduce scope.

SyntaxError: Unexpected token 'export'

Describe the bug
When following the guide I'm getting exception when backstage trying to start with the below error
backstage-5f9894d7dc-d954h backstage-backend SyntaxError: Unexpected token 'export' backstage-5f9894d7dc-d954h backstage-backend at internalCompileFunction (node:internal/vm:73:18) backstage-5f9894d7dc-d954h backstage-backend at wrapSafe (node:internal/modules/cjs/loader:1274:20) backstage-5f9894d7dc-d954h backstage-backend at Module._compile (node:internal/modules/cjs/loader:1320:27) backstage-5f9894d7dc-d954h backstage-backend at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) backstage-5f9894d7dc-d954h backstage-backend at Module.load (node:internal/modules/cjs/loader:1197:32) backstage-5f9894d7dc-d954h backstage-backend at Module._load (node:internal/modules/cjs/loader:1013:12) backstage-5f9894d7dc-d954h backstage-backend at Module.require (node:internal/modules/cjs/loader:1225:19) backstage-5f9894d7dc-d954h backstage-backend at require (node:internal/modules/helpers:177:18) backstage-5f9894d7dc-d954h backstage-backend at Object.<anonymous> (/app/node_modules/@pagerduty/backstage-plugin-backend/dist/index.cjs.js:8:29) backstage-5f9894d7dc-d954h backstage-backend at Module._compile (node:internal/modules/cjs/loader:1356:14) backstage-5f9894d7dc-d954h backstage-backend at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) backstage-5f9894d7dc-d954h backstage-backend at Module.load (node:internal/modules/cjs/loader:1197:32) backstage-5f9894d7dc-d954h backstage-backend at Module._load (node:internal/modules/cjs/loader:1013:12) backstage-5f9894d7dc-d954h backstage-backend at Module.require (node:internal/modules/cjs/loader:1225:19) backstage-5f9894d7dc-d954h backstage-backend at require (node:internal/modules/helpers:177:18) backstage-5f9894d7dc-d954h backstage-backend at Object.<anonymous> (/app/packages/backend/dist/index.cjs.js:22:30) backstage-5f9894d7dc-d954h backstage-backend backstage-5f9894d7dc-d954h backstage-backend Node.js v18.19.0

To Reproduce
Steps to reproduce the behavior:
n/a

Expected behavior
server should start and show PD data

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
kubernetes, ubuntu

Add dropdown to select Escalation Policy

Is your feature request related to a problem? Please describe.
Currently, when creating a PagerDuty service through the scaffolder action users need to provide the Escalation Policy ID. This requires them to copy the Id from the PagerDuty console. This can be improved.

Describe the solution you'd like
I would like to have a dropdown of all Escalation Policies I have access to and just select the correct one.

Describe alternatives you've considered
Currently the only alternative is to copy the Id from PagerDuty. I don't see other way of achieving it.

Migrate to new backend system

Is your feature request related to a problem? Please describe.
Now that new backend system is production-ready, I would like to have the backend plugin migrated to the new approach to simplify customer experience when adding the PagerDuty backend service to their Backstage instance.

Describe the solution you'd like
I would like to be able to migrate to the new backend system without breaking the experience for existing customers/installations.

Describe alternatives you've considered
N/A.

Additional context
Here is the official documentation from Backstage.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.