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
2d52e5d2
Commit
2d52e5d2
authored
Sep 10, 2018
by
Erik Sundell
Committed by
Daniel Lee
Sep 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stackdriver: Use metric type from query controller state
parent
191b6cc3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
public/app/plugins/datasource/stackdriver/datasource.ts
+15
-5
No files found.
public/app/plugins/datasource/stackdriver/datasource.ts
View file @
2d52e5d2
...
@@ -13,13 +13,12 @@ export default class StackdriverDatasource {
...
@@ -13,13 +13,12 @@ export default class StackdriverDatasource {
async
query
(
options
)
{
async
query
(
options
)
{
const
queries
=
options
.
targets
.
filter
(
target
=>
!
target
.
hide
).
map
(
t
=>
({
const
queries
=
options
.
targets
.
filter
(
target
=>
!
target
.
hide
).
map
(
t
=>
({
queryType
:
'raw'
,
refId
:
t
.
refId
,
refId
:
t
.
refId
,
datasourceId
:
this
.
id
,
datasourceId
:
this
.
id
,
metric
:
t
.
metricType
,
metric
Type
:
`metric.type="
${
t
.
metricType
}
"`
,
}));
}));
try
{
try
{
const
response
=
await
this
.
backendSrv
.
datasourceRequest
({
const
{
data
}
=
await
this
.
backendSrv
.
datasourceRequest
({
url
:
'/api/tsdb/query'
,
url
:
'/api/tsdb/query'
,
method
:
'POST'
,
method
:
'POST'
,
data
:
{
data
:
{
...
@@ -28,7 +27,18 @@ export default class StackdriverDatasource {
...
@@ -28,7 +27,18 @@ export default class StackdriverDatasource {
queries
,
queries
,
},
},
});
});
return
response
;
const
result
=
[];
if
(
data
.
results
)
{
Object
[
'values'
](
data
.
results
).
forEach
(
queryRes
=>
{
queryRes
.
series
.
forEach
(
series
=>
{
result
.
push
({
target
:
series
.
name
,
datapoints
:
series
.
points
});
});
});
}
return
{
data
:
result
};
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
}
}
...
@@ -77,7 +87,7 @@ export default class StackdriverDatasource {
...
@@ -77,7 +87,7 @@ export default class StackdriverDatasource {
try
{
try
{
const
metricsApiPath
=
`v3/projects/
${
projectId
}
/metricDescriptors`
;
const
metricsApiPath
=
`v3/projects/
${
projectId
}
/metricDescriptors`
;
const
{
data
}
=
await
this
.
doRequest
(
`
${
this
.
baseUrl
}${
metricsApiPath
}
`
);
const
{
data
}
=
await
this
.
doRequest
(
`
${
this
.
baseUrl
}${
metricsApiPath
}
`
);
return
data
.
metricDescriptors
.
map
(
m
=>
({
id
:
m
.
nam
e
,
name
:
m
.
displayName
}));
return
data
.
metricDescriptors
.
map
(
m
=>
({
id
:
m
.
typ
e
,
name
:
m
.
displayName
}));
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
);
console
.
log
(
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