CloudWatch: Clean up code (#24666)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ func logsResultsToDataframes(response *cloudwatchlogs.GetQueryResultsOutput) (*d
|
||||
|
||||
// Maintaining a list of field names in the order returned from CloudWatch
|
||||
// as just iterating over fieldValues would not give a consistent order
|
||||
fieldNames := make([]*string, 0)
|
||||
fieldNames := make([]string, 0)
|
||||
|
||||
for i, row := range nonEmptyRows {
|
||||
for _, resultField := range row {
|
||||
@@ -42,7 +42,7 @@ func logsResultsToDataframes(response *cloudwatchlogs.GetQueryResultsOutput) (*d
|
||||
}
|
||||
|
||||
if _, exists := fieldValues[*resultField.Field]; !exists {
|
||||
fieldNames = append(fieldNames, resultField.Field)
|
||||
fieldNames = append(fieldNames, *resultField.Field)
|
||||
|
||||
// Check if field is time field
|
||||
if _, err := time.Parse(cloudWatchTSFormat, *resultField.Value); err == nil {
|
||||
@@ -67,11 +67,11 @@ func logsResultsToDataframes(response *cloudwatchlogs.GetQueryResultsOutput) (*d
|
||||
|
||||
newFields := make([]*data.Field, 0)
|
||||
for _, fieldName := range fieldNames {
|
||||
newFields = append(newFields, data.NewField(*fieldName, nil, fieldValues[*fieldName]))
|
||||
newFields = append(newFields, data.NewField(fieldName, nil, fieldValues[fieldName]))
|
||||
|
||||
if *fieldName == "@timestamp" {
|
||||
if fieldName == "@timestamp" {
|
||||
newFields[len(newFields)-1].SetConfig(&data.FieldConfig{Title: "Time"})
|
||||
} else if *fieldName == logStreamIdentifierInternal || *fieldName == logIdentifierInternal {
|
||||
} else if fieldName == logStreamIdentifierInternal || fieldName == logIdentifierInternal {
|
||||
newFields[len(newFields)-1].SetConfig(
|
||||
&data.FieldConfig{
|
||||
Custom: map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user