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
64053e19
Unverified
Commit
64053e19
authored
May 22, 2018
by
Carl Bergquist
Committed by
GitHub
May 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11788 from mtanda/prom_query_timeout
add query timeout option for Prometheus
parents
6d6b509d
067ceb17
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
9 deletions
+27
-9
public/app/plugins/datasource/prometheus/datasource.ts
+8
-0
public/app/plugins/datasource/prometheus/partials/config.html
+19
-9
No files found.
public/app/plugins/datasource/prometheus/datasource.ts
View file @
64053e19
...
@@ -27,6 +27,7 @@ export class PrometheusDatasource {
...
@@ -27,6 +27,7 @@ export class PrometheusDatasource {
withCredentials: any;
withCredentials: any;
metricsNameCache: any;
metricsNameCache: any;
interval: string;
interval: string;
queryTimeout: string;
httpMethod: string;
httpMethod: string;
resultTransformer: ResultTransformer;
resultTransformer: ResultTransformer;
...
@@ -42,6 +43,7 @@ export class PrometheusDatasource {
...
@@ -42,6 +43,7 @@ export class PrometheusDatasource {
this.basicAuth = instanceSettings.basicAuth;
this.basicAuth = instanceSettings.basicAuth;
this.withCredentials = instanceSettings.withCredentials;
this.withCredentials = instanceSettings.withCredentials;
this.interval = instanceSettings.jsonData.timeInterval || '
15
s
';
this.interval = instanceSettings.jsonData.timeInterval || '
15
s
';
this.queryTimeout = instanceSettings.jsonData.queryTimeout;
this.httpMethod = instanceSettings.jsonData.httpMethod || '
GET
';
this.httpMethod = instanceSettings.jsonData.httpMethod || '
GET
';
this.resultTransformer = new ResultTransformer(templateSrv);
this.resultTransformer = new ResultTransformer(templateSrv);
}
}
...
@@ -231,6 +233,9 @@ export class PrometheusDatasource {
...
@@ -231,6 +233,9 @@ export class PrometheusDatasource {
end: end,
end: end,
step: query.step,
step: query.step,
};
};
if (this.queryTimeout) {
data['
timeout
'] = this.queryTimeout;
}
return this._request(url, data, { requestId: query.requestId });
return this._request(url, data, { requestId: query.requestId });
}
}
...
@@ -240,6 +245,9 @@ export class PrometheusDatasource {
...
@@ -240,6 +245,9 @@ export class PrometheusDatasource {
query: query.expr,
query: query.expr,
time: time,
time: time,
};
};
if (this.queryTimeout) {
data['
timeout
'] = this.queryTimeout;
}
return this._request(url, data, { requestId: query.requestId });
return this._request(url, data, { requestId: query.requestId });
}
}
...
...
public/app/plugins/datasource/prometheus/partials/config.html
View file @
64053e19
...
@@ -2,15 +2,25 @@
...
@@ -2,15 +2,25 @@
</datasource-http-settings>
</datasource-http-settings>
<div
class=
"gf-form-group"
>
<div
class=
"gf-form-group"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-8"
>
Scrape interval
</span>
<span
class=
"gf-form-label width-8"
>
Scrape interval
</span>
<input
type=
"text"
class=
"gf-form-input width-8"
ng-model=
"ctrl.current.jsonData.timeInterval"
spellcheck=
'false'
placeholder=
"15s"
></input>
<input
type=
"text"
class=
"gf-form-input width-8"
ng-model=
"ctrl.current.jsonData.timeInterval"
spellcheck=
'false'
placeholder=
"15s"
></input>
<info-popover
mode=
"right-absolute"
>
<info-popover
mode=
"right-absolute"
>
Set this to your global scrape interval defined in your Prometheus config file. This will be used as a lower limit for
Set this to your global scrape interval defined in your Prometheus config file. This will be used as a lower limit for the
the Prometheus step query parameter.
Prometheus step query parameter.
</info-popover>
</info-popover>
</div>
</div>
</div>
<div
class=
"gf-form-inline"
>
<div
class=
"gf-form"
>
<span
class=
"gf-form-label width-8"
>
Query timeout
</span>
<input
type=
"text"
class=
"gf-form-input width-8"
ng-model=
"ctrl.current.jsonData.queryTimeout"
spellcheck=
'false'
placeholder=
"60s"
></input>
<info-popover
mode=
"right-absolute"
>
Set the Prometheus query timeout.
</info-popover>
</div>
</div>
</div>
<div
class=
"gf-form"
>
<div
class=
"gf-form"
>
...
...
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