Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
37bc9cf7
Commit
37bc9cf7
authored
8 years ago
by
Dominik Labuda
Committed by
Cameron Sparr
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[plugins] jolokia input plugin: configurable http timeouts (#2098)
parent
b762546f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
plugins/inputs/jolokia/README.md
+10
-1
10 additions, 1 deletion
plugins/inputs/jolokia/README.md
plugins/inputs/jolokia/jolokia.go
+29
-5
29 additions, 5 deletions
plugins/inputs/jolokia/jolokia.go
with
40 additions
and
6 deletions
CHANGELOG.md
+
1
−
0
View file @
37bc9cf7
...
@@ -43,6 +43,7 @@ plugins, not just statsd.
...
@@ -43,6 +43,7 @@ plugins, not just statsd.
-
[
#1921
](
https://github.com/influxdata/telegraf/issues/1921
)
: Elasticsearch cluster stats support.
-
[
#1921
](
https://github.com/influxdata/telegraf/issues/1921
)
: Elasticsearch cluster stats support.
-
[
#1942
](
https://github.com/influxdata/telegraf/pull/1942
)
: Change Amazon Kinesis output plugin to use the built-in serializer plugins.
-
[
#1942
](
https://github.com/influxdata/telegraf/pull/1942
)
: Change Amazon Kinesis output plugin to use the built-in serializer plugins.
-
[
#1980
](
https://github.com/influxdata/telegraf/issues/1980
)
: Hide username/password from elasticsearch error log messages.
-
[
#1980
](
https://github.com/influxdata/telegraf/issues/1980
)
: Hide username/password from elasticsearch error log messages.
-
[
#2097
](
https://github.com/influxdata/telegraf/issues/2097
)
: Configurable HTTP timeouts in Jolokia plugin
### Bugfixes
### Bugfixes
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/jolokia/README.md
+
10
−
1
View file @
37bc9cf7
...
@@ -18,7 +18,16 @@
...
@@ -18,7 +18,16 @@
# [inputs.jolokia.proxy]
# [inputs.jolokia.proxy]
# host = "127.0.0.1"
# host = "127.0.0.1"
# port = "8080"
# port = "8080"
## Optional http timeouts
##
## response_header_timeout, if non-zero, specifies the amount of time to wait
## for a server's response headers after fully writing the request.
# response_header_timeout = "3s"
##
## client_timeout specifies a time limit for requests made by this client.
## Includes connection time, any redirects, and reading the response body.
# client_timeout = "4s"
## List of servers exposing jolokia read service
## List of servers exposing jolokia read service
[[inputs.jolokia.servers]]
[[inputs.jolokia.servers]]
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/jolokia/jolokia.go
+
29
−
5
View file @
37bc9cf7
...
@@ -11,9 +11,14 @@ import (
...
@@ -11,9 +11,14 @@ import (
"time"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/plugins/inputs"
"github.com/influxdata/telegraf/plugins/inputs"
)
)
// Default http timeouts
var
DefaultResponseHeaderTimeout
=
internal
.
Duration
{
Duration
:
3
*
time
.
Second
}
var
DefaultClientTimeout
=
internal
.
Duration
{
Duration
:
4
*
time
.
Second
}
type
Server
struct
{
type
Server
struct
{
Name
string
Name
string
Host
string
Host
string
...
@@ -48,6 +53,9 @@ type Jolokia struct {
...
@@ -48,6 +53,9 @@ type Jolokia struct {
Servers
[]
Server
Servers
[]
Server
Metrics
[]
Metric
Metrics
[]
Metric
Proxy
Server
Proxy
Server
ResponseHeaderTimeout
internal
.
Duration
`toml:"response_header_timeout"`
ClientTimeout
internal
.
Duration
`toml:"client_timeout"`
}
}
const
sampleConfig
=
`
const
sampleConfig
=
`
...
@@ -66,6 +74,15 @@ const sampleConfig = `
...
@@ -66,6 +74,15 @@ const sampleConfig = `
# host = "127.0.0.1"
# host = "127.0.0.1"
# port = "8080"
# port = "8080"
## Optional http timeouts
##
## response_header_timeout, if non-zero, specifies the amount of time to wait
## for a server's response headers after fully writing the request.
# response_header_timeout = "3s"
##
## client_timeout specifies a time limit for requests made by this client.
## Includes connection time, any redirects, and reading the response body.
# client_timeout = "4s"
## List of servers exposing jolokia read service
## List of servers exposing jolokia read service
[[inputs.jolokia.servers]]
[[inputs.jolokia.servers]]
...
@@ -232,6 +249,15 @@ func extractValues(measurement string, value interface{}, fields map[string]inte
...
@@ -232,6 +249,15 @@ func extractValues(measurement string, value interface{}, fields map[string]inte
}
}
func
(
j
*
Jolokia
)
Gather
(
acc
telegraf
.
Accumulator
)
error
{
func
(
j
*
Jolokia
)
Gather
(
acc
telegraf
.
Accumulator
)
error
{
if
j
.
jClient
==
nil
{
tr
:=
&
http
.
Transport
{
ResponseHeaderTimeout
:
j
.
ResponseHeaderTimeout
.
Duration
}
j
.
jClient
=
&
JolokiaClientImpl
{
&
http
.
Client
{
Transport
:
tr
,
Timeout
:
j
.
ClientTimeout
.
Duration
,
}}
}
servers
:=
j
.
Servers
servers
:=
j
.
Servers
metrics
:=
j
.
Metrics
metrics
:=
j
.
Metrics
tags
:=
make
(
map
[
string
]
string
)
tags
:=
make
(
map
[
string
]
string
)
...
@@ -272,11 +298,9 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
...
@@ -272,11 +298,9 @@ func (j *Jolokia) Gather(acc telegraf.Accumulator) error {
func
init
()
{
func
init
()
{
inputs
.
Add
(
"jolokia"
,
func
()
telegraf
.
Input
{
inputs
.
Add
(
"jolokia"
,
func
()
telegraf
.
Input
{
tr
:=
&
http
.
Transport
{
ResponseHeaderTimeout
:
time
.
Duration
(
3
*
time
.
Second
)}
return
&
Jolokia
{
client
:=
&
http
.
Client
{
ResponseHeaderTimeout
:
DefaultResponseHeaderTimeout
,
Transport
:
tr
,
ClientTimeout
:
DefaultClientTimeout
,
Timeout
:
time
.
Duration
(
4
*
time
.
Second
),
}
}
return
&
Jolokia
{
jClient
:
&
JolokiaClientImpl
{
client
:
client
}}
})
})
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment