0.0.0-nightly-20215725052 • Published 4 years ago

@backstage/plugin-cost-insights v0.0.0-nightly-20215725052

Weekly downloads
533
License
Apache-2.0
Repository
github
Last release
4 years ago

Cost Insights

Cost Insights is a plugin to help engineers visualize, understand and optimize their cloud costs. The Cost Insights page shows daily cost data for a team, trends over time, and comparisons with the business metrics you care about.

At Spotify, we find that cloud costs are optimized organically when:

  • Engineers see cost data in their daily work (that is, in Backstage).
  • It's clear when cloud costs need attention.
  • The data is shown in software terms familiar to them.
  • Alerts and recommendations are targeted and actionable.

Cost Insights shows trends over time, at the granularity of Backstage catalog entities - rather than the cloud provider's concepts. It can be used to troubleshoot cost anomalies, and promote cost-saving infrastructure migrations.

Learn more with the Backstage blog post New Cost Insights plugin: The engineer's solution to taming cloud costs.

Install

# From your Backstage root directory
cd packages/app
yarn add @backstage/plugin-cost-insights

Setup

  1. Configure app-config.yaml. See Configuration.

  2. Create a CostInsights client. Clients must implement the CostInsightsApi interface. Create your own or use a template to get started.

// path/to/CostInsightsClient.ts
import { CostInsightsApi } from '@backstage/plugin-cost-insights';

export class CostInsightsClient implements CostInsightsApi { ... }

Note: We've briefly explored using the AWS Cost Explorer API to implement a Cost Insights client. Learn more about our findings here.

  1. Import the client and the Cost Insights plugin API to your Backstage instance.
// packages/app/src/api.ts
import { createApiFactory } from '@backstage/core';
import { costInsightsApiRef } from '@backstage/plugin-cost-insights';
import { CostInsightsClient } from './path/to/file';

export const apis = [
  createApiFactory({
    api: costInsightsApiRef,
    deps: {},
    factory: () => new CostInsightsClient(),
  }),
];
  1. Add the CostInsightsPage extension to your App.tsx:
// packages/app/src/App.tsx
import { CostInsightsPage } from '@backstage/plugin-cost-insights';

<FlatRoutes>
  ...
  <Route path="/cost-insights" element={<CostInsightsPage />} />
  ...
</FlatRoutes>;
  1. Add Cost Insights to your app Sidebar.

To expose the plugin to your users, you can integrate the cost-insights route anyway that suits your application, but most commonly it is added to the Sidebar.

// packages/app/src/sidebar.tsx
+ import MoneyIcon from '@material-ui/icons/MonetizationOn';

 ...

 export const AppSidebar = () => (
   <Sidebar>
     <SidebarLogo />
     <SidebarSearch />
     <SidebarDivider />
     {/* Global nav, not org-specific */}
     <SidebarItem icon={HomeIcon} to="./" text="Home" />
     <SidebarItem icon={ExtensionIcon} to="api-docs" text="APIs" />
     <SidebarItem icon={LibraryBooks} to="/docs" text="Docs" />
     <SidebarItem icon={CreateComponentIcon} to="create" text="Create..." />
     <SidebarDivider />
     <SidebarItem icon={MapIcon} to="tech-radar" text="Tech Radar" />
+    <SidebarItem icon={MoneyIcon} to="cost-insights" text="Cost Insights" />
     {/* End global nav */}
     <SidebarDivider />
     <SidebarSpace />
     <SidebarDivider />
     <SidebarSettings />
   </Sidebar>
 );

Configuration

Cost Insights has only two required configuration fields: a map of cloud products for showing cost breakdowns and engineerCost - the average yearly cost of an engineer including benefits. Products must be defined as keys on the products field.

You can optionally supply a product icon to display in Cost Insights navigation. See the type file for supported types and Material UI icon mappings.

Note: Product keys should be unique and camelCased. Backstage does not support underscores in configuration keys.

Basic

## ./app-config.yaml
costInsights:
  engineerCost: 200000
  products:
    productA:
      name: Some Cloud Product ## required
      icon: storage
    productB:
      name: Some Other Cloud Product
      icon: data

Metrics (Optional)

In the Cost Overview panel, users can choose from a dropdown of business metrics to see costs as they relate to a metric, such as daily active users. Metrics must be defined as keys on the metrics field. A user-friendly name is required. Metrics will be provided to the getDailyMetricData API method via the metric parameter.

An optional default field can be set to true to set the default comparison metric to daily cost in the Cost Overview panel.

## ./app-config.yaml
costInsights:
  engineerCost: 200000
  products:
    productA:
      name: Some Cloud Product
      icon: storage
    productB:
      name: Some Other Cloud Product
      icon: data
  metrics:
    metricA:
      name: Metric A ## required
      default: true
    metricB:
      name: Metric B
    metricC:
      name: Metric C

Alerts

The CostInsightsApi getAlerts method may return any type of alert or recommendation (called collectively "Action Items" in Cost Insights) that implements the Alert type. This allows you to deliver any alerts or recommendations specific to your infrastructure or company migrations.

To learn more about using Cost Insights' ready-to-use alerts, see the alerts README.

Example implementations of custom alerts, forms and components can be found in the examples directory.

0.12.24

2 years ago

0.12.23

2 years ago

0.12.23-next.1

2 years ago

0.12.23-next.0

2 years ago

0.12.22

2 years ago

0.12.21

2 years ago

0.12.20

2 years ago

0.12.20-next.2

2 years ago

0.12.20-next.1

2 years ago

0.12.20-next.0

2 years ago

0.12.19

2 years ago

0.12.19-next.3

2 years ago

0.12.19-next.2

2 years ago

0.12.19-next.1

2 years ago

0.12.19-next.0

2 years ago

0.12.18

2 years ago

0.12.18-next.2

2 years ago

0.12.18-next.1

2 years ago

0.12.18-next.0

2 years ago

0.12.17

2 years ago

0.12.17-next.3

2 years ago

0.12.17-next.2

2 years ago

0.12.17-next.1

2 years ago

0.12.13-next.3

2 years ago

0.12.13-next.1

2 years ago

0.12.13-next.2

2 years ago

0.12.14-next.1

2 years ago

0.12.14-next.0

2 years ago

0.12.14-next.2

2 years ago

0.12.12-next.0

2 years ago

0.12.9-next.1

2 years ago

0.12.9-next.2

2 years ago

0.12.17-next.0

2 years ago

0.12.9

2 years ago

0.12.10

2 years ago

0.12.11

2 years ago

0.12.16

2 years ago

0.12.12

2 years ago

0.12.13

2 years ago

0.12.14

2 years ago

0.12.15

2 years ago

0.12.15-next.1

2 years ago

0.12.15-next.2

2 years ago

0.12.10-next.0

2 years ago

0.12.10-next.1

2 years ago

0.12.15-next.0

2 years ago

0.12.9-next.0

2 years ago

0.12.8-next.2

2 years ago

0.12.8-next.3

2 years ago

0.12.8

2 years ago

0.12.8-next.0

3 years ago

0.12.8-next.1

3 years ago

0.12.7-next.1

3 years ago

0.12.7-next.2

3 years ago

0.12.7

3 years ago

0.12.7-next.0

3 years ago

0.12.6

3 years ago

0.12.6-next.3

3 years ago

0.12.4

3 years ago

0.12.5

3 years ago

0.12.6-next.1

3 years ago

0.12.6-next.2

3 years ago

0.12.6-next.0

3 years ago

0.12.5-next.1

3 years ago

0.12.5-next.0

3 years ago

0.12.5-next.2

3 years ago

0.12.3-next.2

3 years ago

0.12.3-next.1

3 years ago

0.12.3

3 years ago

0.12.4-next.1

3 years ago

0.12.4-next.2

3 years ago

0.12.4-next.0

3 years ago

0.12.3-next.0

3 years ago

0.12.0

3 years ago

0.12.1

3 years ago

0.12.2

3 years ago

0.11.32

3 years ago

0.12.0-next.1

3 years ago

0.12.0-next.0

3 years ago

0.12.1-next.2

3 years ago

0.12.1-next.3

3 years ago

0.12.1-next.0

3 years ago

0.12.1-next.1

3 years ago

0.12.1-next.4

3 years ago

0.11.32-next.0

3 years ago

0.11.32-next.2

3 years ago

0.11.32-next.1

3 years ago

0.11.31

3 years ago

0.11.31-next.1

3 years ago

0.11.31-next.0

3 years ago

0.11.31-next.3

3 years ago

0.11.31-next.2

3 years ago

0.11.28-next.1

3 years ago

0.11.28-next.0

4 years ago

0.11.28-next.2

3 years ago

0.11.29-next.0

3 years ago

0.11.29-next.1

3 years ago

0.11.29-next.2

3 years ago

0.11.29-next.3

3 years ago

0.11.28

3 years ago

0.11.29

3 years ago

0.11.30

3 years ago

0.11.30-next.1

3 years ago

0.11.30-next.0

3 years ago

0.11.27

4 years ago

0.11.27-next.1

4 years ago

0.11.27-next.0

4 years ago

0.11.26

4 years ago

0.11.24

4 years ago

0.11.25

4 years ago

0.11.26-next.1

4 years ago

0.11.26-next.0

4 years ago

0.11.24-next.0

4 years ago

0.11.23

4 years ago

0.11.20

4 years ago

0.11.21

4 years ago

0.11.22

4 years ago

0.11.20-next.0

4 years ago

0.11.19

4 years ago

0.11.15

4 years ago

0.11.16

4 years ago

0.11.17

4 years ago

0.11.18

4 years ago

0.11.13

4 years ago

0.11.14

4 years ago

0.11.19-next.0

4 years ago

0.11.18-next.0

4 years ago

0.11.11

4 years ago

0.11.12

4 years ago

0.11.10

4 years ago

0.11.9

4 years ago

0.11.8

4 years ago

0.11.7

4 years ago

0.11.6

4 years ago

0.11.5

4 years ago

0.11.4

4 years ago

0.11.3

4 years ago

0.11.2

4 years ago

0.11.1

4 years ago

0.11.0

4 years ago

0.10.1

5 years ago

0.10.2

4 years ago

0.8.5

5 years ago

0.10.0

5 years ago

0.9.0

5 years ago

0.9.1

5 years ago

0.8.4

5 years ago

0.8.3

5 years ago

0.8.2

5 years ago

0.8.1

5 years ago

0.8.0

5 years ago

0.7.0

5 years ago

0.6.0

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.1-alpha.26

5 years ago

0.1.1-alpha.25

5 years ago

0.1.1-alpha.24

5 years ago

0.1.1-alpha.23

5 years ago