From 9de358c3611d5848cf727e12bbb82bf0d7a98419 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Wed, 23 Nov 2022 13:10:55 +0100 Subject: [PATCH 1/9] feat: make engineer threshold configurable Signed-off-by: Chris Langhout --- app-config.yaml | 1 + plugins/cost-insights/README.md | 13 +++++++++++++ plugins/cost-insights/api-report.md | 1 + .../src/components/CostGrowth/CostGrowth.tsx | 7 +++---- .../components/CostGrowth/CostGrowthIndicator.tsx | 4 +++- plugins/cost-insights/src/hooks/useConfig.tsx | 11 +++++++++++ plugins/cost-insights/src/testUtils/providers.tsx | 1 + plugins/cost-insights/src/utils/change.test.ts | 2 +- plugins/cost-insights/src/utils/change.ts | 15 ++++++++++----- 9 files changed, 44 insertions(+), 11 deletions(-) diff --git a/app-config.yaml b/app-config.yaml index ef133491af..dd72051189 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -373,6 +373,7 @@ auth: development: {} costInsights: engineerCost: 200000 + engineerThreshold: 0.5 products: computeEngine: name: Compute Engine diff --git a/plugins/cost-insights/README.md b/plugins/cost-insights/README.md index f65194551a..de9e2d5596 100644 --- a/plugins/cost-insights/README.md +++ b/plugins/cost-insights/README.md @@ -222,6 +222,19 @@ costInsights: rate: 3.5 ``` +### costChangeNegligibleThreshold (Optional; default 0.5) + +This threshold determines whether to show 'Negligible', or a percentage with a fraction of 'engineers' for cost savings or cost excess on top of the charts. +A threshold of 0.5 means that `Negligible` is shown when the difference in costs is lower than that fraction of engineers in that time frame, +and show `XX% or ~N engineers` when it's above the threshold. + +```yaml +## ./app-config.yaml +costInsights: + engineerCost: 200000 + engineerThreshold: 0.5 +``` + ## 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](https://github.com/backstage/backstage/blob/master/plugins/cost-insights/src/types/Alert.ts). This allows you to deliver any alerts or recommendations specific to your infrastructure or company migrations. diff --git a/plugins/cost-insights/api-report.md b/plugins/cost-insights/api-report.md index 8ae49dcedc..9bc662dae1 100644 --- a/plugins/cost-insights/api-report.md +++ b/plugins/cost-insights/api-report.md @@ -237,6 +237,7 @@ export type ConfigContextProps = { products: Product[]; icons: Icon[]; engineerCost: number; + engineerThreshold: number; currencies: Currency[]; }; diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx index d0a4e7901a..cc66c05d3f 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx @@ -19,7 +19,6 @@ import classnames from 'classnames'; import { CurrencyType, Duration, - EngineerThreshold, GrowthType, } from '../../types'; import { ChangeStatistic } from '@backstage/plugin-cost-insights-common'; @@ -42,7 +41,7 @@ export const CostGrowth = (props: CostGrowthProps) => { const { change, duration } = props; const styles = useStyles(); - const { engineerCost } = useConfig(); + const { engineerCost, engineerThreshold } = useConfig(); const [currency] = useCurrency(); // Only display costs in absolute values @@ -55,7 +54,7 @@ export const CostGrowth = (props: CostGrowthProps) => { // If a ratio cannot be calculated, don't format. const growth = notEmpty(change.ratio) - ? growthOf({ ratio: change.ratio, amount: engineers }) + ? growthOf({ ratio: change.ratio, amount: engineers }, engineerThreshold) : null; // Determine if growth is significant enough to highlight const classes = classnames({ @@ -63,7 +62,7 @@ export const CostGrowth = (props: CostGrowthProps) => { [styles.savings]: growth === GrowthType.Savings, }); - if (engineers < EngineerThreshold) { + if (engineers < engineerThreshold) { return Negligible; } diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx index 2591fd5a47..123d1e40b7 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx @@ -23,6 +23,7 @@ import { growthOf } from '../../utils/change'; import { GrowthType } from '../../types'; import { useCostGrowthStyles as useStyles } from '../../utils/styles'; import { ChangeStatistic, Maybe } from '@backstage/plugin-cost-insights-common'; +import { useConfig } from '../../hooks'; /** @public */ export type CostGrowthIndicatorProps = TypographyProps & { @@ -35,10 +36,11 @@ export type CostGrowthIndicatorProps = TypographyProps & { /** @public */ export const CostGrowthIndicator = (props: CostGrowthIndicatorProps) => { + const { engineerThreshold } = useConfig(); const { change, formatter, className, ...extraProps } = props; const classes = useStyles(); - const growth = growthOf(change); + const growth = growthOf(change, engineerThreshold); const classNames = classnames(classes.indicator, className, { [classes.excess]: growth === GrowthType.Excess, diff --git a/plugins/cost-insights/src/hooks/useConfig.tsx b/plugins/cost-insights/src/hooks/useConfig.tsx index 6095f97d49..92b4c6c9f7 100644 --- a/plugins/cost-insights/src/hooks/useConfig.tsx +++ b/plugins/cost-insights/src/hooks/useConfig.tsx @@ -70,6 +70,7 @@ export type ConfigContextProps = { products: Product[]; icons: Icon[]; engineerCost: number; + engineerThreshold: number; currencies: Currency[]; }; @@ -83,6 +84,7 @@ const defaultState: ConfigContextProps = { products: [], icons: [], engineerCost: 0, + engineerThreshold: 0.5, currencies: defaultCurrencies, }; @@ -183,11 +185,19 @@ export const ConfigProvider = ({ children }: PropsWithChildren<{}>) => { return c.getNumber('costInsights.engineerCost'); } + function getEngineerThreshold(): number { + return ( + c.getOptionalNumber('costInsights.engineerThreshold') ?? + defaultState.engineerThreshold + ); + } + function getConfig() { const baseCurrency = getBaseCurrency(); const products = getProducts(); const metrics = getMetrics(); const engineerCost = getEngineerCost(); + const engineerThreshold = getEngineerThreshold(); const icons = getIcons(); const currencies = getCurrencies(); @@ -200,6 +210,7 @@ export const ConfigProvider = ({ children }: PropsWithChildren<{}>) => { metrics, products, engineerCost, + engineerThreshold, icons, currencies, })); diff --git a/plugins/cost-insights/src/testUtils/providers.tsx b/plugins/cost-insights/src/testUtils/providers.tsx index 46eab60163..29123d974b 100644 --- a/plugins/cost-insights/src/testUtils/providers.tsx +++ b/plugins/cost-insights/src/testUtils/providers.tsx @@ -95,6 +95,7 @@ export const MockConfigProvider = (props: MockConfigProviderProps) => { products: [], icons: [], engineerCost: 0, + engineerThreshold: 0.5, currencies: [], }; diff --git a/plugins/cost-insights/src/utils/change.test.ts b/plugins/cost-insights/src/utils/change.test.ts index b17e15797e..1a0b9947f5 100644 --- a/plugins/cost-insights/src/utils/change.test.ts +++ b/plugins/cost-insights/src/utils/change.test.ts @@ -63,7 +63,7 @@ describe.each` expected: GrowthType; }) => { it(`should display ${GrowthMap[expected]}`, () => { - expect(growthOf({ ratio, amount })).toBe(expected); + expect(growthOf({ ratio, amount }, EngineerThreshold)).toBe(expected); }); }, ); diff --git a/plugins/cost-insights/src/utils/change.ts b/plugins/cost-insights/src/utils/change.ts index 3a0d19b123..43d58a021b 100644 --- a/plugins/cost-insights/src/utils/change.ts +++ b/plugins/cost-insights/src/utils/change.ts @@ -18,7 +18,6 @@ import { Cost, ChangeStatistic, ChangeThreshold, - EngineerThreshold, GrowthType, MetricData, Duration, @@ -29,8 +28,11 @@ import { inclusiveStartDateOf } from './duration'; import { notEmpty } from './assert'; // Used for displaying status colors -export function growthOf(change: ChangeStatistic): GrowthType { - const exceedsEngineerThreshold = Math.abs(change.amount) >= EngineerThreshold; +export function growthOf( + change: ChangeStatistic, + engineerThreshold: number, +): GrowthType { + const exceedsEngineerThreshold = Math.abs(change.amount) >= engineerThreshold; if (notEmpty(change.ratio)) { if (exceedsEngineerThreshold && change.ratio >= ChangeThreshold.upper) { @@ -41,9 +43,12 @@ export function growthOf(change: ChangeStatistic): GrowthType { return GrowthType.Savings; } } else { - if (exceedsEngineerThreshold && change.amount > 0) return GrowthType.Excess; - if (exceedsEngineerThreshold && change.amount < 0) + if (exceedsEngineerThreshold && change.amount > 0) { + return GrowthType.Excess; + } + if (exceedsEngineerThreshold && change.amount < 0) { return GrowthType.Savings; + } } return GrowthType.Negligible; From f97c7fd1f7a6445c6324e28c85fe3b15d0822262 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 11:06:04 +0100 Subject: [PATCH 2/9] chore: add changeset Signed-off-by: Chris Langhout --- .changeset/wicked-games-search.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wicked-games-search.md diff --git a/.changeset/wicked-games-search.md b/.changeset/wicked-games-search.md new file mode 100644 index 0000000000..7fedc786b2 --- /dev/null +++ b/.changeset/wicked-games-search.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-cost-insights': patch +--- + +added an optional config entry to allow users to control the threshold value for the 'negligible' change in costs From 9a341d5fd295891b7efbb2aa58628215f86afda0 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 12:26:16 +0100 Subject: [PATCH 3/9] chore: run prettier Signed-off-by: Chris Langhout --- .../cost-insights/src/components/CostGrowth/CostGrowth.tsx | 6 +----- .../src/components/CostGrowth/CostGrowthIndicator.tsx | 1 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx index cc66c05d3f..51f9c61e7b 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.tsx @@ -16,11 +16,7 @@ import React from 'react'; import classnames from 'classnames'; -import { - CurrencyType, - Duration, - GrowthType, -} from '../../types'; +import { CurrencyType, Duration, GrowthType } from '../../types'; import { ChangeStatistic } from '@backstage/plugin-cost-insights-common'; import { rateOf } from '../../utils/currency'; import { growthOf } from '../../utils/change'; diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx index 123d1e40b7..cf07d97d0a 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.tsx @@ -40,6 +40,7 @@ export const CostGrowthIndicator = (props: CostGrowthIndicatorProps) => { const { change, formatter, className, ...extraProps } = props; const classes = useStyles(); + const growth = growthOf(change, engineerThreshold); const classNames = classnames(classes.indicator, className, { From 7b6a317e87f5fa228112d6926b702fdaa888361b Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 13:31:43 +0100 Subject: [PATCH 4/9] fix: tests, adding tests for threshold feature Signed-off-by: Chris Langhout --- .../components/CostGrowth/CostGrowth.test.tsx | 34 +++++++++++++++++-- .../CostGrowth/CostGrowthIndicator.test.tsx | 9 +++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx index 5f47544f7b..6c21e243c8 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx @@ -17,7 +17,7 @@ import React, { PropsWithChildren } from 'react'; import { renderInTestApp } from '@backstage/test-utils'; import { CostGrowth } from './CostGrowth'; -import { Currency, CurrencyType, Duration } from '../../types'; +import { ChangeThreshold, Currency, CurrencyType, Duration } from '../../types'; import { findAlways } from '../../utils/assert'; import { MockConfigProvider, MockCurrencyProvider } from '../../testUtils'; import { defaultCurrencies } from '../../utils/currency'; @@ -33,11 +33,16 @@ const MockContext = ({ children, currency, engineerCost, + engineerThreshold, }: PropsWithChildren<{ currency: Currency; engineerCost: number; + engineerThreshold?: number; }>) => ( - + {children} ); @@ -104,3 +109,28 @@ describe.each` expect(getByText(expected)).toBeInTheDocument(); }); }); + +describe.each` + ratio | amount | threshold | expected + ${0} | ${0} | ${0} | ${'less than an engineer'} + ${0} | ${0} | ${200} | ${'Negligible'} + ${ChangeThreshold.lower} | ${0.5} | ${0} | ${'less than an engineer'} + ${ChangeThreshold.lower} | ${0.5} | ${0.5} | ${'Negligible'} + ${ChangeThreshold.upper} | ${0.5} | ${0.000001} | ${'less than an engineer'} + ${ChangeThreshold.upper} | ${0.5} | ${0.5} | ${'Negligible'} + ${3} | ${500_000} | ${0} | ${`300% or ~ 30 engineers`} + ${3} | ${500_000} | ${30} | ${'Negligible'} +`('', ({ ratio, amount, threshold, expected }) => { + it(`should display the correct difference the threshold is different. ratio: ${ratio} threshold:${threshold} expected:${expected}`, async () => { + const { getByText } = await renderInTestApp( + + + , + ); + expect(getByText(expected)).toBeInTheDocument(); + }); +}); diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.test.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.test.tsx index d0e7d3ff74..a83a520db2 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.test.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowthIndicator.test.tsx @@ -18,6 +18,7 @@ import React from 'react'; import { renderInTestApp } from '@backstage/test-utils'; import { CostGrowthIndicator } from './CostGrowthIndicator'; import { ChangeThreshold, EngineerThreshold } from '../../types'; +import { MockConfigProvider } from '../../testUtils'; describe.each` ratio | amount | ariaLabel @@ -30,7 +31,9 @@ describe.each` `('growthOf', ({ ratio, amount, ariaLabel }) => { it(`should display the correct indicator for ${ariaLabel}`, async () => { const { getByLabelText } = await renderInTestApp( - , + + + , ); expect(getByLabelText(ariaLabel)).toBeInTheDocument(); }); @@ -48,7 +51,9 @@ describe.each` `('growthOf', ({ ratio, amount }) => { it('should display the correct indicator for negligible growth', async () => { const { queryByLabelText } = await renderInTestApp( - , + + + , ); expect(queryByLabelText('savings')).not.toBeInTheDocument(); expect(queryByLabelText('excess')).not.toBeInTheDocument(); From 8ccf0de63ca192bf3fb34a95a30a1917720aa1d2 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 13:44:28 +0100 Subject: [PATCH 5/9] fix: test now succeed; expected had an extra space character Signed-off-by: Chris Langhout --- .../cost-insights/src/components/CostGrowth/CostGrowth.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx index 6c21e243c8..dfc18cb025 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx @@ -118,7 +118,7 @@ describe.each` ${ChangeThreshold.lower} | ${0.5} | ${0.5} | ${'Negligible'} ${ChangeThreshold.upper} | ${0.5} | ${0.000001} | ${'less than an engineer'} ${ChangeThreshold.upper} | ${0.5} | ${0.5} | ${'Negligible'} - ${3} | ${500_000} | ${0} | ${`300% or ~ 30 engineers`} + ${3} | ${500_000} | ${0} | ${`300% or ~30 engineers`} ${3} | ${500_000} | ${30} | ${'Negligible'} `('', ({ ratio, amount, threshold, expected }) => { it(`should display the correct difference the threshold is different. ratio: ${ratio} threshold:${threshold} expected:${expected}`, async () => { From 626b06eb1fc215ff9e48443e8cdd3f0eb6fef0b7 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 13:59:43 +0100 Subject: [PATCH 6/9] chore: add extra test case to make the boundary more clear Signed-off-by: Chris Langhout --- .../cost-insights/src/components/CostGrowth/CostGrowth.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx index dfc18cb025..3da7af90fb 100644 --- a/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx +++ b/plugins/cost-insights/src/components/CostGrowth/CostGrowth.test.tsx @@ -119,6 +119,8 @@ describe.each` ${ChangeThreshold.upper} | ${0.5} | ${0.000001} | ${'less than an engineer'} ${ChangeThreshold.upper} | ${0.5} | ${0.5} | ${'Negligible'} ${3} | ${500_000} | ${0} | ${`300% or ~30 engineers`} + ${3} | ${500_000} | ${0.5} | ${`300% or ~30 engineers`} + ${3} | ${500_000} | ${29} | ${'300% or ~30 engineers'} ${3} | ${500_000} | ${30} | ${'Negligible'} `('', ({ ratio, amount, threshold, expected }) => { it(`should display the correct difference the threshold is different. ratio: ${ratio} threshold:${threshold} expected:${expected}`, async () => { From 5534de6cfacbf05a2c60955384f94b138aa03104 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 15:29:18 +0100 Subject: [PATCH 7/9] fix: resolve feedback Signed-off-by: Chris Langhout --- .changeset/wicked-games-search.md | 2 +- plugins/cost-insights/README.md | 2 +- plugins/cost-insights/config.d.ts | 5 +++++ plugins/cost-insights/src/hooks/useConfig.tsx | 4 ++-- plugins/cost-insights/src/testUtils/providers.tsx | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.changeset/wicked-games-search.md b/.changeset/wicked-games-search.md index 7fedc786b2..5264995a2d 100644 --- a/.changeset/wicked-games-search.md +++ b/.changeset/wicked-games-search.md @@ -2,4 +2,4 @@ '@backstage/plugin-cost-insights': patch --- -added an optional config entry to allow users to control the threshold value for the 'negligible' change in costs +added an optional config entry `costInsights.engineerThreshold` to allow users to control the threshold value for the 'negligible' change in costs. diff --git a/plugins/cost-insights/README.md b/plugins/cost-insights/README.md index de9e2d5596..4aee74ef0a 100644 --- a/plugins/cost-insights/README.md +++ b/plugins/cost-insights/README.md @@ -222,7 +222,7 @@ costInsights: rate: 3.5 ``` -### costChangeNegligibleThreshold (Optional; default 0.5) +### engineerThreshold (Optional; default 0.5) This threshold determines whether to show 'Negligible', or a percentage with a fraction of 'engineers' for cost savings or cost excess on top of the charts. A threshold of 0.5 means that `Negligible` is shown when the difference in costs is lower than that fraction of engineers in that time frame, diff --git a/plugins/cost-insights/config.d.ts b/plugins/cost-insights/config.d.ts index 5317485555..e2387d62bd 100644 --- a/plugins/cost-insights/config.d.ts +++ b/plugins/cost-insights/config.d.ts @@ -21,6 +21,11 @@ export interface Config { */ engineerCost: number; + /** + * @visibility frontend + */ + engineerThreshold: number; + /** * @visibility frontend */ diff --git a/plugins/cost-insights/src/hooks/useConfig.tsx b/plugins/cost-insights/src/hooks/useConfig.tsx index 92b4c6c9f7..d1b3a4788e 100644 --- a/plugins/cost-insights/src/hooks/useConfig.tsx +++ b/plugins/cost-insights/src/hooks/useConfig.tsx @@ -22,7 +22,7 @@ import React, { useState, } from 'react'; import { Config as BackstageConfig } from '@backstage/config'; -import { Currency, Icon, Metric, Product } from '../types'; +import { Currency, EngineerThreshold, Icon, Metric, Product } from '../types'; import { getIcon } from '../utils/navigation'; import { validateCurrencies, validateMetrics } from '../utils/config'; import { createCurrencyFormat, defaultCurrencies } from '../utils/currency'; @@ -84,7 +84,7 @@ const defaultState: ConfigContextProps = { products: [], icons: [], engineerCost: 0, - engineerThreshold: 0.5, + engineerThreshold: EngineerThreshold, currencies: defaultCurrencies, }; diff --git a/plugins/cost-insights/src/testUtils/providers.tsx b/plugins/cost-insights/src/testUtils/providers.tsx index 29123d974b..9522dfb702 100644 --- a/plugins/cost-insights/src/testUtils/providers.tsx +++ b/plugins/cost-insights/src/testUtils/providers.tsx @@ -31,7 +31,7 @@ import { ScrollContext, ScrollContextProps, } from '../hooks'; -import { Duration } from '../types'; +import { Duration, EngineerThreshold } from '../types'; import { createCurrencyFormat } from '../utils/currency'; export type MockFilterProviderProps = PropsWithChildren< @@ -95,7 +95,7 @@ export const MockConfigProvider = (props: MockConfigProviderProps) => { products: [], icons: [], engineerCost: 0, - engineerThreshold: 0.5, + engineerThreshold: EngineerThreshold, currencies: [], }; From 60ae55c50a3e86ca81761a3aa89987192d1a79c5 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 15:35:19 +0100 Subject: [PATCH 8/9] fix: title spelling consistency -- using separate words Signed-off-by: Chris Langhout --- plugins/cost-insights/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cost-insights/README.md b/plugins/cost-insights/README.md index 4aee74ef0a..a7bcb0cb0a 100644 --- a/plugins/cost-insights/README.md +++ b/plugins/cost-insights/README.md @@ -222,7 +222,7 @@ costInsights: rate: 3.5 ``` -### engineerThreshold (Optional; default 0.5) +### Engineer Threshold (Optional; default 0.5) This threshold determines whether to show 'Negligible', or a percentage with a fraction of 'engineers' for cost savings or cost excess on top of the charts. A threshold of 0.5 means that `Negligible` is shown when the difference in costs is lower than that fraction of engineers in that time frame, From 077c832c955977c4e08157a8f3cf41e763393786 Mon Sep 17 00:00:00 2001 From: Chris Langhout Date: Fri, 25 Nov 2022 16:27:20 +0100 Subject: [PATCH 9/9] fix: engineerThreshold in config.d.ts is optional Signed-off-by: Chris Langhout --- plugins/cost-insights/config.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/cost-insights/config.d.ts b/plugins/cost-insights/config.d.ts index e2387d62bd..61a54f76e2 100644 --- a/plugins/cost-insights/config.d.ts +++ b/plugins/cost-insights/config.d.ts @@ -24,7 +24,7 @@ export interface Config { /** * @visibility frontend */ - engineerThreshold: number; + engineerThreshold?: number; /** * @visibility frontend