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
77f23018
Unverified
Commit
77f23018
authored
Oct 18, 2018
by
Marcus Efraimsson
Committed by
GitHub
Oct 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13684 from mtanda/cw_concurrent_map
fix concurrent map writes
parents
0b490912
48aef0c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
pkg/tsdb/cloudwatch/cloudwatch.go
+16
-10
No files found.
pkg/tsdb/cloudwatch/cloudwatch.go
View file @
77f23018
...
...
@@ -86,9 +86,10 @@ func (e *CloudWatchExecutor) Query(ctx context.Context, dsInfo *models.DataSourc
}
func
(
e
*
CloudWatchExecutor
)
executeTimeSeriesQuery
(
ctx
context
.
Context
,
queryContext
*
tsdb
.
TsdbQuery
)
(
*
tsdb
.
Response
,
error
)
{
result
:=
&
tsdb
.
Response
{
result
s
:=
&
tsdb
.
Response
{
Results
:
make
(
map
[
string
]
*
tsdb
.
QueryResult
),
}
resultChan
:=
make
(
chan
*
tsdb
.
QueryResult
,
len
(
queryContext
.
Queries
))
eg
,
ectx
:=
errgroup
.
WithContext
(
ctx
)
...
...
@@ -102,10 +103,10 @@ func (e *CloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, queryCo
RefId
:=
queryContext
.
Queries
[
i
]
.
RefId
query
,
err
:=
parseQuery
(
queryContext
.
Queries
[
i
]
.
Model
)
if
err
!=
nil
{
result
.
Results
[
RefId
]
=
&
tsdb
.
QueryResult
{
result
s
.
Results
[
RefId
]
=
&
tsdb
.
QueryResult
{
Error
:
err
,
}
return
result
,
nil
return
result
s
,
nil
}
query
.
RefId
=
RefId
...
...
@@ -118,10 +119,10 @@ func (e *CloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, queryCo
}
if
query
.
Id
==
""
&&
query
.
Expression
!=
""
{
result
.
Results
[
query
.
RefId
]
=
&
tsdb
.
QueryResult
{
result
s
.
Results
[
query
.
RefId
]
=
&
tsdb
.
QueryResult
{
Error
:
fmt
.
Errorf
(
"Invalid query: id should be set if using expression"
),
}
return
result
,
nil
return
result
s
,
nil
}
eg
.
Go
(
func
()
error
{
...
...
@@ -130,12 +131,13 @@ func (e *CloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, queryCo
return
err
}
if
err
!=
nil
{
result
.
Results
[
query
.
RefId
]
=
&
tsdb
.
QueryResult
{
resultChan
<-
&
tsdb
.
QueryResult
{
RefId
:
query
.
RefId
,
Error
:
err
,
}
return
nil
}
result
.
Results
[
queryRes
.
RefId
]
=
queryRes
result
Chan
<-
queryRes
return
nil
})
}
...
...
@@ -149,10 +151,10 @@ func (e *CloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, queryCo
return
err
}
for
_
,
queryRes
:=
range
queryResponses
{
result
.
Results
[
queryRes
.
RefId
]
=
queryRes
if
err
!=
nil
{
result
.
Results
[
queryRes
.
RefId
]
.
Error
=
err
queryRes
.
Error
=
err
}
resultChan
<-
queryRes
}
return
nil
})
...
...
@@ -162,8 +164,12 @@ func (e *CloudWatchExecutor) executeTimeSeriesQuery(ctx context.Context, queryCo
if
err
:=
eg
.
Wait
();
err
!=
nil
{
return
nil
,
err
}
close
(
resultChan
)
for
result
:=
range
resultChan
{
results
.
Results
[
result
.
RefId
]
=
result
}
return
result
,
nil
return
result
s
,
nil
}
func
(
e
*
CloudWatchExecutor
)
executeQuery
(
ctx
context
.
Context
,
query
*
CloudWatchQuery
,
queryContext
*
tsdb
.
TsdbQuery
)
(
*
tsdb
.
QueryResult
,
error
)
{
...
...
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