Add write timeout to Riemann output (#2576)
This commit is contained in:
parent
a855718cd9
commit
29ea9be71e
|
@ -84,6 +84,7 @@ be deprecated eventually.
|
||||||
- [#2513](https://github.com/influxdata/telegraf/issues/2513): create /etc/telegraf/telegraf.d directory in tarball.
|
- [#2513](https://github.com/influxdata/telegraf/issues/2513): create /etc/telegraf/telegraf.d directory in tarball.
|
||||||
- [#2541](https://github.com/influxdata/telegraf/issues/2541): Return error on unsupported serializer data format.
|
- [#2541](https://github.com/influxdata/telegraf/issues/2541): Return error on unsupported serializer data format.
|
||||||
- [#1827](https://github.com/influxdata/telegraf/issues/1827): Fix Windows Performance Counters multi instance identifier
|
- [#1827](https://github.com/influxdata/telegraf/issues/1827): Fix Windows Performance Counters multi instance identifier
|
||||||
|
- [#2576](https://github.com/influxdata/telegraf/pull/2576): Add write timeout to Riemann output
|
||||||
|
|
||||||
|
|
||||||
## v1.2.1 [2017-02-01]
|
## v1.2.1 [2017-02-01]
|
||||||
|
|
|
@ -34,6 +34,9 @@ This plugin writes to [Riemann](http://riemann.io/) via TCP or UDP.
|
||||||
|
|
||||||
## Description for Riemann event
|
## Description for Riemann event
|
||||||
# description_text = "metrics collected from telegraf"
|
# description_text = "metrics collected from telegraf"
|
||||||
|
|
||||||
|
## Riemann client write timeout, defaults to "5s" if not set.
|
||||||
|
# timeout = "5s"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Required parameters:
|
### Required parameters:
|
||||||
|
|
|
@ -7,9 +7,11 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/amir/raidman"
|
"github.com/amir/raidman"
|
||||||
"github.com/influxdata/telegraf"
|
"github.com/influxdata/telegraf"
|
||||||
|
"github.com/influxdata/telegraf/internal"
|
||||||
"github.com/influxdata/telegraf/plugins/outputs"
|
"github.com/influxdata/telegraf/plugins/outputs"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,6 +24,7 @@ type Riemann struct {
|
||||||
TagKeys []string
|
TagKeys []string
|
||||||
Tags []string
|
Tags []string
|
||||||
DescriptionText string
|
DescriptionText string
|
||||||
|
Timeout internal.Duration
|
||||||
|
|
||||||
client *raidman.Client
|
client *raidman.Client
|
||||||
}
|
}
|
||||||
|
@ -54,6 +57,9 @@ var sampleConfig = `
|
||||||
|
|
||||||
## Description for Riemann event
|
## Description for Riemann event
|
||||||
# description_text = "metrics collected from telegraf"
|
# description_text = "metrics collected from telegraf"
|
||||||
|
|
||||||
|
## Riemann client write timeout, defaults to "5s" if not set.
|
||||||
|
# timeout = "5s"
|
||||||
`
|
`
|
||||||
|
|
||||||
func (r *Riemann) Connect() error {
|
func (r *Riemann) Connect() error {
|
||||||
|
@ -62,7 +68,7 @@ func (r *Riemann) Connect() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := raidman.Dial(parsed_url.Scheme, parsed_url.Host)
|
client, err := raidman.DialWithTimeout(parsed_url.Scheme, parsed_url.Host, r.Timeout.Duration)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
r.client = nil
|
r.client = nil
|
||||||
return err
|
return err
|
||||||
|
@ -212,6 +218,8 @@ func (r *Riemann) tags(tags map[string]string) []string {
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
outputs.Add("riemann", func() telegraf.Output {
|
outputs.Add("riemann", func() telegraf.Output {
|
||||||
return &Riemann{}
|
return &Riemann{
|
||||||
|
Timeout: internal.Duration{Duration: time.Second * 5},
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue