mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 19:54:10 -06:00
AzureMonitor: Remove Basic Logs retention warning (#92870)
Remove retention warning
This commit is contained in:
parent
94068977f5
commit
11c1af0c5f
@ -19,9 +19,7 @@ import QueryField from './QueryField';
|
|||||||
import { TimeManagement } from './TimeManagement';
|
import { TimeManagement } from './TimeManagement';
|
||||||
import { setBasicLogsQuery, setFormatAs, setKustoQuery } from './setQueryValue';
|
import { setBasicLogsQuery, setFormatAs, setKustoQuery } from './setQueryValue';
|
||||||
import useMigrations from './useMigrations';
|
import useMigrations from './useMigrations';
|
||||||
import { calculateTimeRange, shouldShowBasicLogsToggle } from './utils';
|
import { shouldShowBasicLogsToggle } from './utils';
|
||||||
|
|
||||||
const MAX_DATA_RETENTION_DAYS = 8; // limit is only for basic logs
|
|
||||||
|
|
||||||
interface LogsQueryEditorProps {
|
interface LogsQueryEditorProps {
|
||||||
query: AzureMonitorQuery;
|
query: AzureMonitorQuery;
|
||||||
@ -52,7 +50,6 @@ const LogsQueryEditor = ({
|
|||||||
const [showBasicLogsToggle, setShowBasicLogsToggle] = useState<boolean>(
|
const [showBasicLogsToggle, setShowBasicLogsToggle] = useState<boolean>(
|
||||||
shouldShowBasicLogsToggle(query.azureLogAnalytics?.resources || [], basicLogsEnabled)
|
shouldShowBasicLogsToggle(query.azureLogAnalytics?.resources || [], basicLogsEnabled)
|
||||||
);
|
);
|
||||||
const [showDataRetentionWarning, setShowDataRetentionWarning] = useState<boolean>(false);
|
|
||||||
const [dataIngestedWarning, setDataIngestedWarning] = useState<React.ReactNode | null>(null);
|
const [dataIngestedWarning, setDataIngestedWarning] = useState<React.ReactNode | null>(null);
|
||||||
const templateSrv = getTemplateSrv();
|
const templateSrv = getTemplateSrv();
|
||||||
const from = templateSrv?.replace('$__from');
|
const from = templateSrv?.replace('$__from');
|
||||||
@ -96,17 +93,6 @@ const LogsQueryEditor = ({
|
|||||||
}
|
}
|
||||||
}, [basicLogsEnabled, onChange, query, showBasicLogsToggle]);
|
}, [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(() => {
|
useEffect(() => {
|
||||||
const getBasicLogsUsage = async (query: AzureMonitorQuery) => {
|
const getBasicLogsUsage = async (query: AzureMonitorQuery) => {
|
||||||
try {
|
try {
|
||||||
@ -247,13 +233,6 @@ const LogsQueryEditor = ({
|
|||||||
</EditorFieldGroup>
|
</EditorFieldGroup>
|
||||||
</EditorRow>
|
</EditorRow>
|
||||||
</EditorRows>
|
</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>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user