Files
backstage/plugins/cost-insights
Mayursinh Sarvaiya 5c6a0356c0 feat: TechDocs - Add vale linter to check words quality in md files. (#2631)
* fix(docs): typos which were reflacted from vale linter's command

* feat: Implement Vale linter (#2031)
Initialize .vale.ini file
Add 'lint:docs' script to package.json, to lint all md files except the ones which are located in node_modules
Generate 'vocab.txt' by using command 'yarn run lint:docs' | grep -o ''[a-z A-Z]*'' | grep -o '[a-z A-Z]*' | sort | uniq > .github/styles/vocab.txt
Add steps to github workflow 'master' to check docs quality

* chore: Separate workflow for quality checking

* chore: Added 'shx' dev dependency to support grep command in cross platform

* feat: Add script to operate same quality check process on different platform

* ignore: remove lint:docs from lint-stages which was added for experiment purpose

* fix: check-all-files on push event & check-changed-files on pull_request event

* chore(CI): triggle workflow only when there is any updates in .md file(s) on pull request

* fix: use spawnSync to solve 'The command line is too long.' error

* fix: github workflow syntax

* fix: prettier error

* chore: add vale command directly to lint-staged

* chore: use shebang for easy access

* fix: windows script issue & remove shebang

* chore: Add shebang flag

* chore: better error message related to vale

* chore: mention vale linter in documentation

* fix: spelling errors & add keywords to vocab.txt
2020-10-02 07:20:47 +02:00
..
2020-09-28 15:20:31 -04:00
2020-09-28 15:20:31 -04:00
2020-09-28 15:20:31 -04:00
2020-09-28 15:20:31 -04:00
2020-09-28 15:20:31 -04:00

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 your software deployments - rather than the cloud provider's concepts. It can be used to troubleshoot cost anomalies, and promote cost-saving infrastructure migrations.

Install

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. See the API file for required methods and documentation.

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

export class CostInsightsClient implements CostInsightsApi { ... }
  1. Import the client and the CostInsights 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 cost-insights to your Backstage plugins.
// packages/app/src/plugins.ts
export { plugin as CostInsights } from '@backstage/plugin-cost-insights';

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 getDailyCost and getProjectCosts API methods via the metric parameter.

Note: Cost Insights displays daily cost without a metric by default. The dropdown text for this default can be overridden by assigning it a value on the dailyCost field.

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