Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
c60765a1
Unverified
Commit
c60765a1
authored
May 14, 2020
by
Andrej Ocenas
Committed by
GitHub
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CloudWatch/Logs: Fix panic on multiple aggregations queries (#24683)
parent
141c21c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
pkg/tsdb/cloudwatch/log_query.go
+5
-6
pkg/tsdb/cloudwatch/log_query_test.go
+2
-0
No files found.
pkg/tsdb/cloudwatch/log_query.go
View file @
c60765a1
...
@@ -8,14 +8,13 @@ import (
...
@@ -8,14 +8,13 @@ import (
)
)
func
logsResultsToDataframes
(
response
*
cloudwatchlogs
.
GetQueryResultsOutput
)
(
*
data
.
Frame
,
error
)
{
func
logsResultsToDataframes
(
response
*
cloudwatchlogs
.
GetQueryResultsOutput
)
(
*
data
.
Frame
,
error
)
{
rowCount
:=
len
(
response
.
Results
)
fieldValues
:=
make
(
map
[
string
]
interface
{})
fieldValues
:=
make
(
map
[
string
]
interface
{})
// Maintaining a list of field names in the order returned from CloudWatch
// Maintaining a list of field names in the order returned from CloudWatch
// as just iterating over fieldValues would not give a consistent order
// as just iterating over fieldValues would not give a consistent order
fieldNames
:=
make
([]
*
string
,
0
)
fieldNames
:=
make
([]
*
string
,
0
)
for
i
,
row
:=
range
response
.
Results
{
for
_
,
row
:=
range
response
.
Results
{
for
_
,
resultField
:=
range
row
{
for
_
,
resultField
:=
range
row
{
// Strip @ptr field from results as it's not needed
// Strip @ptr field from results as it's not needed
if
*
resultField
.
Field
==
"@ptr"
{
if
*
resultField
.
Field
==
"@ptr"
{
...
@@ -27,9 +26,9 @@ func logsResultsToDataframes(response *cloudwatchlogs.GetQueryResultsOutput) (*d
...
@@ -27,9 +26,9 @@ func logsResultsToDataframes(response *cloudwatchlogs.GetQueryResultsOutput) (*d
// Check if field is time field
// Check if field is time field
if
_
,
err
:=
time
.
Parse
(
cloudWatchTSFormat
,
*
resultField
.
Value
);
err
==
nil
{
if
_
,
err
:=
time
.
Parse
(
cloudWatchTSFormat
,
*
resultField
.
Value
);
err
==
nil
{
fieldValues
[
*
resultField
.
Field
]
=
make
([]
*
time
.
Time
,
rowCount
)
fieldValues
[
*
resultField
.
Field
]
=
make
([]
*
time
.
Time
,
0
)
}
else
{
}
else
{
fieldValues
[
*
resultField
.
Field
]
=
make
([]
*
string
,
rowCount
)
fieldValues
[
*
resultField
.
Field
]
=
make
([]
*
string
,
0
)
}
}
}
}
...
@@ -39,9 +38,9 @@ func logsResultsToDataframes(response *cloudwatchlogs.GetQueryResultsOutput) (*d
...
@@ -39,9 +38,9 @@ func logsResultsToDataframes(response *cloudwatchlogs.GetQueryResultsOutput) (*d
return
nil
,
err
return
nil
,
err
}
}
timeField
[
i
]
=
&
parsedTime
fieldValues
[
*
resultField
.
Field
]
=
append
(
timeField
,
&
parsedTime
)
}
else
{
}
else
{
fieldValues
[
*
resultField
.
Field
]
.
([]
*
string
)[
i
]
=
resultField
.
Value
fieldValues
[
*
resultField
.
Field
]
=
append
(
fieldValues
[
*
resultField
.
Field
]
.
([]
*
string
),
resultField
.
Value
)
}
}
}
}
}
}
...
...
pkg/tsdb/cloudwatch/log_query_test.go
View file @
c60765a1
...
@@ -78,6 +78,8 @@ func TestLogsResultsToDataframes(t *testing.T) {
...
@@ -78,6 +78,8 @@ func TestLogsResultsToDataframes(t *testing.T) {
Value
:
aws
.
String
(
"fakelog"
),
Value
:
aws
.
String
(
"fakelog"
),
},
},
},
},
// Sometimes cloudwatch returns empty row
{},
{
{
&
cloudwatchlogs
.
ResultField
{
&
cloudwatchlogs
.
ResultField
{
Field
:
aws
.
String
(
"@ptr"
),
Field
:
aws
.
String
(
"@ptr"
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment