Azure Monitor: Blank result formats are not overwritten (#93493)
* if result format is null from previous query, it will be null and not correct to a different format * update to not have empty value in result format field * fix tests * add check to see if options are in list * reformat stuff so logic lives on the right layer * linterrrrrrrrrrrrrrrrrrRR * Apply suggestions from code review * if result format is null from previous query, it will be null and not correct to a different format * update to not have empty value in result format field * fix tests * add check to see if options are in list * reformat stuff so logic lives on the right layer * linterrrrrrrrrrrrrrrrrrRR * frontend linter * linter * feedback :)
This commit is contained in:
@@ -64,22 +64,20 @@ func meetsBasicLogsCriteria(resources []string, fromAlert bool, basicLogsEnabled
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// This function should be part of migration function
|
||||
func ParseResultFormat(queryResultFormat *dataquery.ResultFormat, queryType dataquery.AzureQueryType) dataquery.ResultFormat {
|
||||
var resultFormat dataquery.ResultFormat
|
||||
if queryResultFormat != nil {
|
||||
resultFormat = *queryResultFormat
|
||||
if queryResultFormat != nil && *queryResultFormat != "" {
|
||||
return *queryResultFormat
|
||||
}
|
||||
if resultFormat == "" {
|
||||
if queryType == dataquery.AzureQueryTypeAzureLogAnalytics {
|
||||
// Default to logs format for logs queries
|
||||
resultFormat = dataquery.ResultFormatLogs
|
||||
}
|
||||
if queryType == dataquery.AzureQueryTypeAzureTraces {
|
||||
// Default to table format for traces queries as many traces may be returned
|
||||
resultFormat = dataquery.ResultFormatTable
|
||||
}
|
||||
if queryType == dataquery.AzureQueryTypeAzureLogAnalytics {
|
||||
// Default to time series format for logs queries. It was time series before this change
|
||||
return dataquery.ResultFormatTimeSeries
|
||||
}
|
||||
return resultFormat
|
||||
if queryType == dataquery.AzureQueryTypeAzureTraces {
|
||||
// Default to table format for traces queries as many traces may be returned
|
||||
return dataquery.ResultFormatTable
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func getApiURL(resourceOrWorkspace string, isAppInsightsQuery bool, basicLogsQuery bool) string {
|
||||
|
||||
Reference in New Issue
Block a user