Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,48 +110,4 @@ describe('useMetricDetectorAnomalyThresholds', () => {

expect(anomalyDataRequest).not.toHaveBeenCalled();
});

it('includes legacy_alert query param when isLegacyAlert is true', async () => {
const organization = OrganizationFixture();

const mockData = [
{
external_alert_id: 24,
timestamp: 1609459200,
value: 100,
yhat_lower: 80,
yhat_upper: 120,
},
];

const anomalyDataRequest = MockApiClient.addMockResponse({
url: `/organizations/${organization.slug}/detectors/123/anomaly-data/`,
body: {data: mockData},
match: [MockApiClient.matchQuery({legacy_alert: 'true'})],
});

const series = [
{
seriesName: 'count()',
data: [{name: 1609459200000, value: 100}],
},
];

renderHookWithProviders(
() =>
useMetricDetectorAnomalyThresholds({
detectorId: '123',
detectionType: 'dynamic',
startTimestamp: 1609459200,
endTimestamp: 1609545600,
series,
isLegacyAlert: true,
}),
{organization}
);

await waitFor(() => {
expect(anomalyDataRequest).toHaveBeenCalled();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ interface UseMetricDetectorAnomalyThresholdsProps {
detectorId: string;
detectionType?: string;
endTimestamp?: number;
isLegacyAlert?: boolean; // for Alerts, remove this once every AlertRule has a migrated Detector
series?: Series[];
startTimestamp?: number;
}
Expand All @@ -49,7 +48,6 @@ export function useMetricDetectorAnomalyThresholds({
startTimestamp,
endTimestamp,
series = [],
isLegacyAlert = false,
}: UseMetricDetectorAnomalyThresholdsProps): UseMetricDetectorAnomalyThresholdsResult {
const organization = useOrganization();
const theme = useTheme();
Expand All @@ -72,7 +70,6 @@ export function useMetricDetectorAnomalyThresholds({
query: {
start: startTimestamp,
end: endTimestamp,
...(isLegacyAlert && {legacy_alert: 'true'}),
},
},
],
Expand Down
Loading