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
993e5636
Unverified
Commit
993e5636
authored
Aug 13, 2019
by
Dominik Prokop
Committed by
GitHub
Aug 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Annotations: Fix failing annotation query when time series query is cancelled (#18532)
parent
f689b604
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
public/app/plugins/datasource/prometheus/datasource.ts
+4
-0
public/app/plugins/datasource/prometheus/specs/datasource.test.ts
+13
-0
No files found.
public/app/plugins/datasource/prometheus/datasource.ts
View file @
993e5636
...
@@ -41,6 +41,7 @@ export interface PromDataQueryResponse {
...
@@ -41,6 +41,7 @@ export interface PromDataQueryResponse {
result
?:
DataQueryResponseData
[];
result
?:
DataQueryResponseData
[];
};
};
};
};
cancelled
?:
boolean
;
}
}
export
class
PrometheusDatasource
extends
DataSourceApi
<
PromQuery
,
PromOptions
>
{
export
class
PrometheusDatasource
extends
DataSourceApi
<
PromQuery
,
PromOptions
>
{
...
@@ -528,6 +529,9 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
...
@@ -528,6 +529,9 @@ export class PrometheusDatasource extends DataSourceApi<PromQuery, PromOptions>
const
eventList
:
AnnotationEvent
[]
=
[];
const
eventList
:
AnnotationEvent
[]
=
[];
tagKeys
=
tagKeys
.
split
(
','
);
tagKeys
=
tagKeys
.
split
(
','
);
if
(
results
.
cancelled
)
{
return
[];
}
_
.
each
(
results
.
data
.
data
.
result
,
series
=>
{
_
.
each
(
results
.
data
.
data
.
result
,
series
=>
{
const
tags
=
_
.
chain
(
series
.
metric
)
const
tags
=
_
.
chain
(
series
.
metric
)
.
filter
((
v
,
k
)
=>
{
.
filter
((
v
,
k
)
=>
{
...
...
public/app/plugins/datasource/prometheus/specs/datasource.test.ts
View file @
993e5636
...
@@ -667,6 +667,19 @@ describe('PrometheusDatasource', () => {
...
@@ -667,6 +667,19 @@ describe('PrometheusDatasource', () => {
},
},
};
};
describe('
when
time
series
query
is
cancelled
', () => {
it('
should
return
empty
results
', async () => {
backendSrv.datasourceRequest = jest.fn(() => Promise.resolve({ cancelled: true }));
ctx.ds = new PrometheusDatasource(instanceSettings, q, backendSrv as any, templateSrv as any, timeSrv as any);
await ctx.ds.annotationQuery(options).then((data: any) => {
results = data;
});
expect(results).toEqual([]);
});
});
describe('
not
use
useValueForTime
', () => {
describe('
not
use
useValueForTime
', () => {
beforeEach(async () => {
beforeEach(async () => {
options.annotation.useValueForTime = false;
options.annotation.useValueForTime = false;
...
...
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