Skip to content

Input consul - incompatible with output opentsdb #7871

@unflag

Description

@unflag

Relevant telegraf.conf:

[[inputs.consul]]
  address = "consul.service.consul:8500"
  scheme = "http"
  tag_delimiter = "="

[[outputs.opentsdb]]
  host = "http://opentsdb.service.consul"
  port = 8429
  httpBatchSize = 50000

System info:

Telegraf 1.14.5 (git: HEAD e77ce3d)

Steps to reproduce:

Run telegraf using given configuration.

Expected behavior:

All metrics successfully converted to opentsdb format.

Actual behavior:

Some fields dropped due to invalid values:

2020-07-21T16:59:15Z D! OpenTSDB does not support metric value: [Service 'mesos-slave' check] of type [string].

Additional info:

This behavior connected with this part of plugin:

func (c *Consul) GatherHealthCheck(acc telegraf.Accumulator, checks []*api.HealthCheck) {
	for _, check := range checks {
		record := make(map[string]interface{})
		tags := make(map[string]string)

		record["check_name"] = check.Name
		record["service_id"] = check.ServiceID

		record["status"] = check.Status

The fact is that OpenTSDB metric format doesn't allow string values, but output plugin uses fields as metric's value source and if field has no proper value - it just lost. So, I propose to place check_name, service_id and status fields into tags map - in this case all fields with string value would be safe with other tags. In my opinion it wouldn't disagree to anything. Prometheus has similar to opentsdb metric format and InfluxDB advises to not place commonly-queried metadata(which are check_name, service_id and status) in fields.

Maybe I missing something, if so - please point me. And if there is no objections I would like to submit PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/consulfeature requestRequests for new plugin and for new features to existing plugins

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions