2023-01-09 09:30:21 -06:00
import { CloudWatchLogsQuery , CloudWatchMetricsQuery , LogGroup , MetricEditorMode , MetricQueryType } from './types' ;
2022-12-14 05:21:36 -06:00
export const DEFAULT_METRICS_QUERY : Omit < CloudWatchMetricsQuery , ' refId ' > = {
queryMode : 'Metrics' ,
namespace : '' ,
metricName : '' ,
expression : '' ,
dimensions : { } ,
region : 'default' ,
id : '' ,
statistic : 'Average' ,
period : '' ,
metricQueryType : MetricQueryType.Search ,
metricEditorMode : MetricEditorMode.Builder ,
sqlExpression : '' ,
matchExact : true ,
} ;
2023-01-09 09:30:21 -06:00
export const getDefaultLogsQuery = (
defaultLogGroups? : LogGroup [ ] ,
legacyDefaultLogGroups? : string [ ]
) : Omit < CloudWatchLogsQuery , ' refId ' | ' queryMode ' > = > ( {
2022-12-14 05:21:36 -06:00
id : '' ,
region : 'default' ,
expression : '' ,
2023-01-09 09:30:21 -06:00
// in case legacy default log groups have been defined in the ConfigEditor, they will be migrated in the LogGroupsField component or the next time the ConfigEditor is opened.
// the migration requires async backend calls, so we don't want to do it here as it would block the UI.
logGroupNames : legacyDefaultLogGroups ,
logGroups : defaultLogGroups ? ? [ ] ,
2022-12-14 05:21:36 -06:00
} ) ;