[v11.1.x] AzureMonitor: Remove Basic Logs retention warning (#93122)

AzureMonitor: Remove Basic Logs retention warning (#92870)

Remove retention warning

(cherry picked from commit 11c1af0c5f)

Co-authored-by: Andreas Christou <andreas.christou@grafana.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-09-12 14:43:27 +01:00
committed by GitHub
co-authored by Andreas Christou
parent 74da8c09e3
commit bca08a06fc
@@ -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>
);
};