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
945131cc
Commit
945131cc
authored
Mar 08, 2016
by
Kaveh Nowroozi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add annotations for opentsdb
parent
95f3e520
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
3 deletions
+53
-3
public/app/plugins/datasource/opentsdb/datasource.js
+36
-1
public/app/plugins/datasource/opentsdb/module.ts
+5
-1
public/app/plugins/datasource/opentsdb/partials/annotations.editor.html
+10
-0
public/app/plugins/datasource/opentsdb/plugin.json
+2
-1
No files found.
public/app/plugins/datasource/opentsdb/datasource.js
View file @
945131cc
...
@@ -69,6 +69,40 @@ function (angular, _, dateMath) {
...
@@ -69,6 +69,40 @@ function (angular, _, dateMath) {
}.
bind
(
this
));
}.
bind
(
this
));
};
};
this
.
annotationQuery
=
function
(
options
)
{
var
start
=
convertToTSDBTime
(
options
.
rangeRaw
.
from
,
false
);
var
end
=
convertToTSDBTime
(
options
.
rangeRaw
.
to
,
true
);
var
qs
=
[];
var
eventList
=
[];
qs
.
push
({
aggregator
:
"sum"
,
metric
:
options
.
annotation
.
target
});
var
queries
=
_
.
compact
(
qs
);
return
this
.
performTimeSeriesQuery
(
queries
,
start
,
end
).
then
(
function
(
results
)
{
if
(
results
.
data
[
0
])
{
var
annotationObject
=
results
.
data
[
0
].
annotations
;
if
(
options
.
annotation
.
isGlobal
){
annotationObject
=
results
.
data
[
0
].
globalAnnotations
;
}
if
(
annotationObject
)
{
_
.
each
(
annotationObject
,
function
(
annotation
)
{
var
event
=
{
title
:
annotation
.
description
,
time
:
Math
.
floor
(
annotation
.
startTime
)
*
1000
,
text
:
annotation
.
notes
,
annotation
:
options
.
annotation
};
eventList
.
push
(
event
);
});
}
}
return
eventList
;
}.
bind
(
this
));
};
this
.
performTimeSeriesQuery
=
function
(
queries
,
start
,
end
)
{
this
.
performTimeSeriesQuery
=
function
(
queries
,
start
,
end
)
{
var
msResolution
=
false
;
var
msResolution
=
false
;
if
(
this
.
tsdbResolution
===
2
)
{
if
(
this
.
tsdbResolution
===
2
)
{
...
@@ -77,7 +111,8 @@ function (angular, _, dateMath) {
...
@@ -77,7 +111,8 @@ function (angular, _, dateMath) {
var
reqBody
=
{
var
reqBody
=
{
start
:
start
,
start
:
start
,
queries
:
queries
,
queries
:
queries
,
msResolution
:
msResolution
msResolution
:
msResolution
,
globalAnnotations
:
true
};
};
// Relative queries (e.g. last hour) don't include an end time
// Relative queries (e.g. last hour) don't include an end time
...
...
public/app/plugins/datasource/opentsdb/module.ts
View file @
945131cc
...
@@ -2,9 +2,13 @@ import {OpenTsDatasource} from './datasource';
...
@@ -2,9 +2,13 @@ import {OpenTsDatasource} from './datasource';
import
{
OpenTsQueryCtrl
}
from
'./query_ctrl'
;
import
{
OpenTsQueryCtrl
}
from
'./query_ctrl'
;
import
{
OpenTsConfigCtrl
}
from
'./config_ctrl'
;
import
{
OpenTsConfigCtrl
}
from
'./config_ctrl'
;
class
AnnotationsQueryCtrl
{
static
templateUrl
=
'partials/annotations.editor.html'
;
}
export
{
export
{
OpenTsDatasource
as
Datasource
,
OpenTsDatasource
as
Datasource
,
OpenTsQueryCtrl
as
QueryCtrl
,
OpenTsQueryCtrl
as
QueryCtrl
,
OpenTsConfigCtrl
as
ConfigCtrl
,
OpenTsConfigCtrl
as
ConfigCtrl
,
AnnotationsQueryCtrl
as
AnnotationsQueryCtrl
};
};
public/app/plugins/datasource/opentsdb/partials/annotations.editor.html
0 → 100644
View file @
945131cc
<div
class=
"gf-form-group"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-13"
>
OpenTSDB metrics query
</span>
<input
type=
"text"
class=
"gf-form-input"
ng-model=
'ctrl.annotation.target'
placeholder=
"events.eventname"
></input>
</div>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-13"
>
Show Global Annotations?
</span>
<editor-checkbox
text=
""
model=
"ctrl.annotation.isGlobal"
></editor-checkbox>
</div>
</div>
public/app/plugins/datasource/opentsdb/plugin.json
View file @
945131cc
...
@@ -4,5 +4,6 @@
...
@@ -4,5 +4,6 @@
"id"
:
"opentsdb"
,
"id"
:
"opentsdb"
,
"metrics"
:
true
,
"metrics"
:
true
,
"defaultMatchFormat"
:
"pipe"
"defaultMatchFormat"
:
"pipe"
,
"annotations"
:
true
}
}
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