AzureMonitor: Remove Basic Logs retention warning (#92870)

Remove retention warning
This commit is contained in:
Andreas Christou 2024-09-09 16:15:55 +01:00 committed by GitHub
parent 94068977f5
commit 11c1af0c5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,9 +19,7 @@ import QueryField from './QueryField';
import { TimeManagement } from './TimeManagement';
import { setBasicLogsQuery, setFormatAs, setKustoQuery } from './setQueryValue';
import useMigrations from './useMigrations';
import { calculateTimeRange, shouldShowBasicLogsToggle } from './utils';
const MAX_DATA_RETENTION_DAYS = 8; // limit is only for basic logs
import { shouldShowBasicLogsToggle } from './utils';
interface LogsQueryEditorProps {
query: AzureMonitorQuery;
@ -52,7 +50,6 @@ const LogsQueryEditor = ({
const [showBasicLogsToggle, setShowBasicLogsToggle] = useState<boolean>(
shouldShowBasicLogsToggle(query.azureLogAnalytics?.resources || [], basicLogsEnabled)
);
const [showDataRetentionWarning, setShowDataRetentionWarning] = useState<boolean>(false);
const [dataIngestedWarning, setDataIngestedWarning] = useState<React.ReactNode | null>(null);
const templateSrv = getTemplateSrv();
const from = templateSrv?.replace('$__from');
@ -96,17 +93,6 @@ const LogsQueryEditor = ({
}
}, [basicLogsEnabled, onChange, query, showBasicLogsToggle]);
useEffect(() => {
const timeRange = calculateTimeRange(parseInt(from, 10), parseInt(to, 10));
// Basic logs data retention is fixed at 8 days
// need to add this check to make user aware of this limitation in case they have selected a longer time range
if (showBasicLogsToggle && query.azureLogAnalytics?.basicLogsQuery && timeRange > MAX_DATA_RETENTION_DAYS) {
setShowDataRetentionWarning(true);
} else {
setShowDataRetentionWarning(false);
}
}, [query.azureLogAnalytics?.basicLogsQuery, showBasicLogsToggle, from, to]);
useEffect(() => {
const getBasicLogsUsage = async (query: AzureMonitorQuery) => {
try {
@ -247,13 +233,6 @@ const LogsQueryEditor = ({
</EditorFieldGroup>
</EditorRow>
</EditorRows>
{showDataRetentionWarning && (
<Alert severity="warning" title="Basic Logs data retention">
<Text>
Data retention for Basic Logs is fixed at eight days. You will only see data within this timeframe.
</Text>
</Alert>
)}
</span>
);
};