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
f58e228d
Commit
f58e228d
authored
Jun 30, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lexh-restrict-tag-keys-values'
parents
aedaae85
97f54ac3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
2 deletions
+51
-2
public/app/plugins/datasource/opentsdb/datasource.js
+49
-0
public/app/plugins/datasource/opentsdb/queryCtrl.js
+2
-2
No files found.
public/app/plugins/datasource/opentsdb/datasource.js
View file @
f58e228d
...
@@ -90,6 +90,55 @@ function (angular, _, kbn) {
...
@@ -90,6 +90,55 @@ function (angular, _, kbn) {
});
});
};
};
OpenTSDBDatasource
.
prototype
.
performMetricKeyValueLookup
=
function
(
metric
,
key
)
{
if
(
!
metric
||
!
key
)
{
return
$q
.
when
([]);
}
var
m
=
metric
+
"{"
+
key
+
"=*}"
;
var
options
=
{
method
:
'GET'
,
url
:
this
.
url
+
'/api/search/lookup'
,
params
:
{
m
:
m
,
}
};
return
backendSrv
.
datasourceRequest
(
options
).
then
(
function
(
result
)
{
result
=
result
.
data
.
results
;
var
tagvs
=
[];
_
.
each
(
result
,
function
(
r
)
{
tagvs
.
push
(
r
.
tags
[
key
]);
});
return
tagvs
;
});
};
OpenTSDBDatasource
.
prototype
.
performMetricKeyLookup
=
function
(
metric
)
{
if
(
metric
===
""
)
{
throw
"Metric not set."
;
}
var
options
=
{
method
:
'GET'
,
url
:
this
.
url
+
'/api/search/lookup'
,
params
:
{
m
:
metric
,
}
};
return
backendSrv
.
datasourceRequest
(
options
).
then
(
function
(
result
)
{
result
=
result
.
data
.
results
;
var
tagks
=
[];
_
.
each
(
result
,
function
(
r
)
{
_
.
each
(
r
.
tags
,
function
(
tagv
,
tagk
)
{
if
(
tagks
.
indexOf
(
tagk
)
===
-
1
)
{
tagks
.
push
(
tagk
);
}
});
});
return
tagks
;
});
};
OpenTSDBDatasource
.
prototype
.
testDatasource
=
function
()
{
OpenTSDBDatasource
.
prototype
.
testDatasource
=
function
()
{
return
this
.
performSuggestQuery
(
'cpu'
,
'metrics'
).
then
(
function
()
{
return
this
.
performSuggestQuery
(
'cpu'
,
'metrics'
).
then
(
function
()
{
return
{
status
:
"success"
,
message
:
"Data source is working"
,
title
:
"Success"
};
return
{
status
:
"success"
,
message
:
"Data source is working"
,
title
:
"Success"
};
...
...
public/app/plugins/datasource/opentsdb/queryCtrl.js
View file @
f58e228d
...
@@ -50,13 +50,13 @@ function (angular, _, kbn) {
...
@@ -50,13 +50,13 @@ function (angular, _, kbn) {
$scope
.
suggestTagKeys
=
function
(
query
,
callback
)
{
$scope
.
suggestTagKeys
=
function
(
query
,
callback
)
{
$scope
.
datasource
$scope
.
datasource
.
perform
SuggestQuery
(
query
,
'tagk'
)
.
perform
MetricKeyLookup
(
$scope
.
target
.
metric
)
.
then
(
callback
);
.
then
(
callback
);
};
};
$scope
.
suggestTagValues
=
function
(
query
,
callback
)
{
$scope
.
suggestTagValues
=
function
(
query
,
callback
)
{
$scope
.
datasource
$scope
.
datasource
.
perform
SuggestQuery
(
query
,
'tagv'
)
.
perform
MetricKeyValueLookup
(
$scope
.
target
.
metric
,
$scope
.
target
.
currentTagKey
)
.
then
(
callback
);
.
then
(
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