add overwrite tags for Riemann
This commit is contained in:
parent
747f39a7da
commit
8c555661eb
|
@ -4,6 +4,7 @@
|
|||
|
||||
### Features
|
||||
|
||||
- [#1845](https://github.com/influxdata/telegraf/pull/1845): Send measurement as Riemann tag, add overwrite tags.
|
||||
- [#1782](https://github.com/influxdata/telegraf/pull/1782): Allow numeric and non-string values for tag_keys.
|
||||
- [#1694](https://github.com/influxdata/telegraf/pull/1694): Adding Gauge and Counter metric types.
|
||||
- [#1606](https://github.com/influxdata/telegraf/pull/1606): Remove carraige returns from exec plugin output on Windows
|
||||
|
@ -29,6 +30,7 @@
|
|||
|
||||
### Bugfixes
|
||||
|
||||
- [#1501](https://github.com/influxdata/telegraf/issues/1501): Send metric tags as Riemann tags and attributes.
|
||||
- [#1746](https://github.com/influxdata/telegraf/issues/1746): Fix handling of non-string values for JSON keys listed in tag_keys.
|
||||
- [#1628](https://github.com/influxdata/telegraf/issues/1628): Fix mongodb input panic on version 2.2.
|
||||
- [#1733](https://github.com/influxdata/telegraf/issues/1733): Fix statsd scientific notation parsing
|
||||
|
|
|
@ -440,7 +440,8 @@
|
|||
# separator = " "
|
||||
# ## set measurement name as a Riemann tag instead of prepending it to the Riemann service name
|
||||
# measurement_as_tag = false
|
||||
|
||||
# ## list of Riemann tags, if specified use these instead of any Telegraf tags
|
||||
# tags = ["telegraf","custom_tag"]
|
||||
|
||||
|
||||
###############################################################################
|
||||
|
|
|
@ -16,6 +16,7 @@ type Riemann struct {
|
|||
Transport string
|
||||
Separator string
|
||||
MeasurementAsTag bool
|
||||
Tags []string
|
||||
|
||||
client *raidman.Client
|
||||
}
|
||||
|
@ -29,6 +30,8 @@ var sampleConfig = `
|
|||
separator = " "
|
||||
## set measurement name as a Riemann tag instead of prepending it to the Riemann service name
|
||||
measurement_as_tag = false
|
||||
## list of Riemann tags, if specified use these instead of any Telegraf tags
|
||||
tags = ["telegraf","custom_tag"]
|
||||
`
|
||||
|
||||
func (r *Riemann) Connect() error {
|
||||
|
@ -107,7 +110,7 @@ func (r *Riemann) buildEvents(p telegraf.Metric) []*raidman.Event {
|
|||
Host: host,
|
||||
Service: r.service(p.Name(), fieldName),
|
||||
Tags: r.tags(p.Name(), p.Tags()),
|
||||
Attributes: p.Tags(),
|
||||
Attributes: r.attributes(p.Name(), p.Tags()),
|
||||
Time: p.Time().Unix(),
|
||||
}
|
||||
|
||||
|
@ -125,7 +128,18 @@ func (r *Riemann) buildEvents(p telegraf.Metric) []*raidman.Event {
|
|||
return events
|
||||
}
|
||||
|
||||
func (r *Riemann) attributes(name string, tags map[string]string) map[string]string {
|
||||
if r.MeasurementAsTag {
|
||||
tags["measurement"] = name
|
||||
}
|
||||
return tags
|
||||
}
|
||||
|
||||
func (r *Riemann) tags(name string, tags map[string]string) []string {
|
||||
if len(r.Tags) > 0 {
|
||||
return r.Tags
|
||||
}
|
||||
|
||||
var tagNames, tagValues []string
|
||||
|
||||
for tagName := range tags {
|
||||
|
|
Loading…
Reference in New Issue