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
f64bcf0d
Commit
f64bcf0d
authored
Jul 31, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:heldr/grafana into heldr-master
parents
c48b6e23
1f283d93
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
18 deletions
+37
-18
src/app/partials/opentsdb/editor.html
+11
-1
src/app/services/opentsdb/opentsdbDatasource.js
+26
-17
No files found.
src/app/partials/opentsdb/editor.html
View file @
f64bcf0d
...
...
@@ -43,7 +43,7 @@
<ul
class=
"grafana-segment-list"
role=
"menu"
>
<li>
<input
type=
"text"
class=
"
input-xxlarge
grafana-target-segment-input"
class=
"grafana-target-segment-input"
ng-model=
"target.metric"
spellcheck=
'false'
bs-typeahead=
"suggestMetrics"
...
...
@@ -57,6 +57,16 @@
<i
class=
"icon-warning-sign"
></i>
</a>
</li>
<li>
<input
type=
"text"
class=
"grafana-target-segment-input"
ng-model=
"target.chartLabel"
spellcheck=
'false'
placeholder=
"chart label(optional)"
data-min-length=
0
data-items=
100
ng-blur=
"targetBlur()"
/>
</li>
<li
class=
"grafana-target-segment"
>
Aggregator
<li>
...
...
src/app/services/opentsdb/opentsdbDatasource.js
View file @
f64bcf0d
...
...
@@ -38,12 +38,12 @@ function (angular, _, kbn) {
});
return
this
.
performTimeSeriesQuery
(
queries
,
start
,
end
)
.
then
(
function
(
response
)
{
var
result
=
_
.
map
(
response
.
data
,
function
(
metricData
)
{
return
transformMetricData
(
metricData
,
groupByTags
);
});
.
then
(
_
.
bind
(
function
(
response
)
{
var
result
=
_
.
map
(
response
.
data
,
_
.
bind
(
function
(
metricData
,
index
)
{
return
transformMetricData
(
metricData
,
groupByTags
,
this
.
targets
[
index
]
);
}
,
this
)
);
return
{
data
:
result
};
});
}
,
options
)
);
};
OpenTSDBDatasource
.
prototype
.
performTimeSeriesQuery
=
function
(
queries
,
start
,
end
)
{
...
...
@@ -80,8 +80,20 @@ function (angular, _, kbn) {
});
};
function
transformMetricData
(
md
,
groupByTags
)
{
var
dps
=
[];
function
transformMetricData
(
md
,
groupByTags
,
options
)
{
var
dps
=
[],
tagData
=
[],
metricLabel
=
null
;
if
(
!
_
.
isEmpty
(
md
.
tags
))
{
_
.
each
(
_
.
pairs
(
md
.
tags
),
function
(
tag
)
{
if
(
_
.
has
(
groupByTags
,
tag
[
0
]))
{
tagData
.
push
(
tag
[
0
]
+
"="
+
tag
[
1
]);
}
});
}
metricLabel
=
createMetricLabel
(
md
.
metric
,
tagData
,
options
);
// TSDB returns datapoints has a hash of ts => value.
// Can't use _.pairs(invert()) because it stringifies keys/values
...
...
@@ -89,22 +101,19 @@ function (angular, _, kbn) {
dps
.
push
([
v
,
k
]);
});
var
target
=
md
.
metric
;
if
(
!
_
.
isEmpty
(
md
.
tags
))
{
var
tagData
=
[];
return
{
target
:
metricLabel
,
datapoints
:
dps
};
}
_
.
each
(
_
.
pairs
(
md
.
tags
),
function
(
tag
)
{
if
(
_
.
has
(
groupByTags
,
tag
[
0
])
)
{
tagData
.
push
(
tag
[
0
]
+
"="
+
tag
[
1
])
;
function
createMetricLabel
(
metric
,
tagData
,
options
)
{
if
(
options
.
chartLabel
)
{
return
options
.
chartLabel
;
}
});
if
(
!
_
.
isEmpty
(
tagData
))
{
target
=
target
+
"{"
+
tagData
.
join
(
", "
)
+
"}"
;
}
metric
+=
"{"
+
tagData
.
join
(
", "
)
+
"}"
;
}
return
{
target
:
target
,
datapoints
:
dps
}
;
return
metric
;
}
function
convertTargetToQuery
(
target
)
{
...
...
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