Skip to content

Commit 6957798

Browse files
committed
style(lint): apply prettier formatting (CI lint)
Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
1 parent 4314a73 commit 6957798

4 files changed

Lines changed: 68 additions & 68 deletions

File tree

public/components/apm/pages/slos/__tests__/slo_budget_remaining_chart.test.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ jest.mock('@osd/ui-shared-deps/theme', () => ({
4545
},
4646
}));
4747

48-
function makeSlo(
49-
overrides: Partial<SloDocument['spec']> = {}
50-
): SloDocument & {
48+
function makeSlo(overrides: Partial<SloDocument['spec']> = {}): SloDocument & {
5149
liveStatus: SloLiveStatus;
5250
} {
5351
return {
@@ -345,9 +343,7 @@ describe('SloBudgetRemainingChart', () => {
345343
refetch: jest.fn(),
346344
});
347345
const slo = makeSlo({ window: { type: 'calendar', period: 'week', timezone: 'UTC' } });
348-
render(
349-
<SloBudgetRemainingChart slo={slo} objective={slo.spec.objectives[0]} {...baseProps} />
350-
);
346+
render(<SloBudgetRemainingChart slo={slo} objective={slo.spec.objectives[0]} {...baseProps} />);
351347
expect(screen.getByText(/calendar-week/i)).toBeInTheDocument();
352348
// The equivalent rolling range for a week is 7d — the old code hardcoded 30d.
353349
expect(screen.getByText(/7d/)).toBeInTheDocument();

public/components/apm/pages/slos/slo_budget_remaining_chart.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ const CALENDAR_PERIOD_DURATIONS: Record<CalendarWindow['period'], string> = {
5454

5555
/** Resolve the PromQL range duration the chart should query for this window. */
5656
export function deriveWindowDuration(window: Window): string {
57-
return window.type === 'rolling'
58-
? window.duration
59-
: CALENDAR_PERIOD_DURATIONS[window.period];
57+
return window.type === 'rolling' ? window.duration : CALENDAR_PERIOD_DURATIONS[window.period];
6058
}
6159

6260
/**
@@ -264,11 +262,10 @@ export const SloBudgetRemainingChart: React.FC<SloBudgetRemainingChartProps> = (
264262
// rolling range of equal length (recording rules for calendar windows aren't
265263
// wired up yet). Never hardcode "30d" — that mislabeled every calendar SLO.
266264
const window = useMemo(() => deriveWindowDuration(slo.spec.window), [slo.spec.window]);
267-
const query = useMemo(() => buildBudgetRemainingExpr(slo, objective, window), [
268-
slo,
269-
objective,
270-
window,
271-
]);
265+
const query = useMemo(
266+
() => buildBudgetRemainingExpr(slo, objective, window),
267+
[slo, objective, window]
268+
);
272269

273270
// The first budget-warning threshold drives the "at risk" line. Sort
274271
// descending so a list like [0.25, 0.5, 0.1] still surfaces the most

public/components/apm/pages/slos/slo_burn_rate_chart.tsx

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export function buildBurnRateOption(inputs: BurnRateOptionInputs): echarts.EChar
150150
const ts = formatTooltipTs(list[0].axisValue, tz);
151151
const rows = list
152152
.map((p) => {
153-
const raw = Array.isArray(p.value) ? p.value[2] ?? p.value[1] : (p.value as number);
153+
const raw = Array.isArray(p.value) ? (p.value[2] ?? p.value[1]) : (p.value as number);
154154
const swatch = `<span style="display:inline-block;width:10px;height:10px;background:${p.color};margin-right:6px;border-radius:2px;"></span>`;
155155
// Delta versus this tier's threshold: how much over/under the burn
156156
// rate that would fire the alert.
@@ -284,11 +284,10 @@ const TierFetcher: React.FC<TierFetcherProps> = ({
284284
errorBudget,
285285
onChange,
286286
}) => {
287-
const query = useMemo(() => buildErrorRatioExprForWindow(slo, objective, tier.longWindow), [
288-
slo,
289-
objective,
290-
tier.longWindow,
291-
]);
287+
const query = useMemo(
288+
() => buildErrorRatioExprForWindow(slo, objective, tier.longWindow),
289+
[slo, objective, tier.longWindow]
290+
);
292291
const { series, isLoading, error } = usePromQLChartData({
293292
promqlQuery: query ?? '',
294293
timeRange,
@@ -448,46 +447,56 @@ export const SloBurnRateChart: React.FC<SloBurnRateChartProps> = ({
448447
<EuiText size="s">{firstError.message}</EuiText>
449448
</EuiCallOut>
450449
)}
451-
{tiers.length > 0 && !firstError && !isLoading && !hasData && !probeLoading && !metricExists && (
452-
<EuiCallOut
453-
size="s"
454-
color="warning"
455-
iconType="alert"
456-
title={i18n.translate('observability.apm.slo.burnRateChart.missingMetric.title', {
457-
defaultMessage: 'SLI source metric not found in this datasource',
458-
})}
459-
data-test-subj="slosBurnRateMissingMetric"
460-
>
461-
<EuiText size="s">
462-
{i18n.translate('observability.apm.slo.burnRateChart.missingMetric.bodyPrefix', {
463-
defaultMessage: 'No samples exist for the metric this SLI queries on',
450+
{tiers.length > 0 &&
451+
!firstError &&
452+
!isLoading &&
453+
!hasData &&
454+
!probeLoading &&
455+
!metricExists && (
456+
<EuiCallOut
457+
size="s"
458+
color="warning"
459+
iconType="alert"
460+
title={i18n.translate('observability.apm.slo.burnRateChart.missingMetric.title', {
461+
defaultMessage: 'SLI source metric not found in this datasource',
464462
})}
465-
<strong> {prometheusConnectionId}</strong>
466-
{i18n.translate('observability.apm.slo.burnRateChart.missingMetric.bodySuffix', {
467-
defaultMessage:
468-
". Burn rate is derived from the same error ratio as the budget chart — if that metric is absent, burn rate can't populate. Waiting won't help; re-check the SLI's metric / selectors.",
463+
data-test-subj="slosBurnRateMissingMetric"
464+
>
465+
<EuiText size="s">
466+
{i18n.translate('observability.apm.slo.burnRateChart.missingMetric.bodyPrefix', {
467+
defaultMessage: 'No samples exist for the metric this SLI queries on',
468+
})}
469+
<strong> {prometheusConnectionId}</strong>
470+
{i18n.translate('observability.apm.slo.burnRateChart.missingMetric.bodySuffix', {
471+
defaultMessage:
472+
". Burn rate is derived from the same error ratio as the budget chart — if that metric is absent, burn rate can't populate. Waiting won't help; re-check the SLI's metric / selectors.",
473+
})}
474+
</EuiText>
475+
</EuiCallOut>
476+
)}
477+
{tiers.length > 0 &&
478+
!firstError &&
479+
!isLoading &&
480+
!hasData &&
481+
!probeLoading &&
482+
metricExists && (
483+
<EuiCallOut
484+
size="s"
485+
color="primary"
486+
iconType="iInCircle"
487+
title={i18n.translate('observability.apm.slo.burnRateChart.emptyRange.title', {
488+
defaultMessage: 'No samples in the selected time range',
469489
})}
470-
</EuiText>
471-
</EuiCallOut>
472-
)}
473-
{tiers.length > 0 && !firstError && !isLoading && !hasData && !probeLoading && metricExists && (
474-
<EuiCallOut
475-
size="s"
476-
color="primary"
477-
iconType="iInCircle"
478-
title={i18n.translate('observability.apm.slo.burnRateChart.emptyRange.title', {
479-
defaultMessage: 'No samples in the selected time range',
480-
})}
481-
data-test-subj="slosBurnRateEmpty"
482-
>
483-
<EuiText size="s">
484-
{i18n.translate('observability.apm.slo.burnRateChart.emptyRange.body', {
485-
defaultMessage:
486-
'The metric exists in this datasource but the current range returned no burn-rate samples. Widen the time range, or wait for the next Prometheus scrape + rule evaluation.',
487-
})}
488-
</EuiText>
489-
</EuiCallOut>
490-
)}
490+
data-test-subj="slosBurnRateEmpty"
491+
>
492+
<EuiText size="s">
493+
{i18n.translate('observability.apm.slo.burnRateChart.emptyRange.body', {
494+
defaultMessage:
495+
'The metric exists in this datasource but the current range returned no burn-rate samples. Widen the time range, or wait for the next Prometheus scrape + rule evaluation.',
496+
})}
497+
</EuiText>
498+
</EuiCallOut>
499+
)}
491500
{tiers.length > 0 && hasData && <EchartsRender spec={spec} height={260} />}
492501
{overflow > 0 && (
493502
<>

public/components/apm/pages/slos/slo_burn_rate_panel.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,14 @@ const TierCard: React.FC<TierCardProps> = ({
272272
reportKey,
273273
onHealthChange,
274274
}) => {
275-
const shortQuery = useMemo(() => buildErrorRatioExprForWindow(slo, objective, tier.shortWindow), [
276-
slo,
277-
objective,
278-
tier.shortWindow,
279-
]);
280-
const longQuery = useMemo(() => buildErrorRatioExprForWindow(slo, objective, tier.longWindow), [
281-
slo,
282-
objective,
283-
tier.longWindow,
284-
]);
275+
const shortQuery = useMemo(
276+
() => buildErrorRatioExprForWindow(slo, objective, tier.shortWindow),
277+
[slo, objective, tier.shortWindow]
278+
);
279+
const longQuery = useMemo(
280+
() => buildErrorRatioExprForWindow(slo, objective, tier.longWindow),
281+
[slo, objective, tier.longWindow]
282+
);
285283

286284
const shortData = usePromQLChartData({
287285
promqlQuery: shortQuery ?? '',

0 commit comments

Comments
 (0)