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
f4ad673b
Commit
f4ad673b
authored
Jan 31, 2016
by
Ivan Babrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show relevant tag name suggestions for OpenTSDB, closes #3610
parent
80e15dd7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
public/app/plugins/datasource/opentsdb/datasource.js
+19
-2
public/app/plugins/datasource/opentsdb/query_ctrl.ts
+1
-3
No files found.
public/app/plugins/datasource/opentsdb/datasource.js
View file @
f4ad673b
...
...
@@ -15,6 +15,7 @@ function (angular, _, dateMath) {
this
.
withCredentials
=
instanceSettings
.
withCredentials
;
this
.
basicAuth
=
instanceSettings
.
basicAuth
;
this
.
supportMetrics
=
true
;
this
.
tagKeys
=
{};
// Called once per panel (graph)
this
.
query
=
function
(
options
)
{
...
...
@@ -50,10 +51,13 @@ function (angular, _, dateMath) {
if
(
index
===
-
1
)
{
index
=
0
;
}
this
.
_saveTagKeys
(
metricData
);
return
transformMetricData
(
metricData
,
groupByTags
,
options
.
targets
[
index
],
options
);
});
}
.
bind
(
this
)
);
return
{
data
:
result
};
});
}
.
bind
(
this
)
);
};
this
.
performTimeSeriesQuery
=
function
(
queries
,
start
,
end
)
{
...
...
@@ -87,6 +91,19 @@ function (angular, _, dateMath) {
return
backendSrv
.
datasourceRequest
(
options
);
};
this
.
suggestTagKeys
=
function
(
metric
)
{
return
$q
.
when
(
this
.
tagKeys
[
metric
]
||
[]);
};
this
.
_saveTagKeys
=
function
(
metricData
)
{
var
tagKeys
=
Object
.
keys
(
metricData
.
tags
);
_
.
each
(
metricData
.
aggregateTags
,
function
(
tag
)
{
tagKeys
.
push
(
tag
);
});
this
.
tagKeys
[
metricData
.
metric
]
=
tagKeys
;
};
this
.
_performSuggestQuery
=
function
(
query
,
type
)
{
return
this
.
_get
(
'/api/suggest'
,
{
type
:
type
,
q
:
query
,
max
:
1000
}).
then
(
function
(
result
)
{
return
result
.
data
;
...
...
public/app/plugins/datasource/opentsdb/query_ctrl.ts
View file @
f4ad673b
...
...
@@ -50,9 +50,7 @@ export class OpenTsQueryCtrl extends QueryCtrl {
};
this
.
suggestTagKeys
=
(
query
,
callback
)
=>
{
this
.
datasource
.
metricFindQuery
(
'suggest_tagk('
+
query
+
')'
)
.
then
(
this
.
getTextValues
)
.
then
(
callback
);
this
.
datasource
.
suggestTagKeys
(
this
.
target
.
metric
).
then
(
callback
);
};
this
.
suggestTagValues
=
(
query
,
callback
)
=>
{
...
...
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