Skip to content

Telegraf cannot start - panic: reflect: call of reflect.Value.Elem on int64 Value #8829

@gl1ridae

Description

@gl1ridae

Relevant telegraf.conf:

[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 2000
  metric_buffer_limit = 20000
  collection_jitter = "0s"
  flush_interval = "60s"
  flush_jitter = "30s"
  precision = "0s"
  logfile = "/var/log/telegraf/telegraf.log"
  debug = false
  quiet = false
  hostname = ""
  omit_hostname = true

# INPUTS
[[inputs.system]]
  # no additional configuration

[[outputs.prometheus_client]]
  listen = ":9273"
  expiration_interval = "120s"
  collectors_exclude = ["gocollector", "process"]
  string_as_label = true
  metric_version = 1
  flush_interval = "15s"
  flush_jitter = "10s"

System info:

Telegraf version: 1.17.2
OS: Debian 6.10, Ubuntu 16

Steps to reproduce:

  1. Set the telegraf version 1.17.2 and add output prometheus_client config, with option flush_jitter
  2. Start telegraf

Expected behavior:

Telegraf should start and pass metrics to output.

Actual behavior:

Telegraf failed to start with panic:

2021-02-07T17:23:17Z I! Starting Telegraf 1.17.2
panic: reflect: call of reflect.Value.Elem on int64 Value
goroutine 1 [running]:
reflect.Value.Elem(0x2c92bc0, 0x495f780, 0x86, 0x0, 0x0, 0x1)
        /usr/local/go/src/reflect/value.go:843 +0x1a5
github.com/influxdata/telegraf/config.(*Config).getFieldDuration(0xc0002842a0, 0xc0000ac820, 0x2ef3a10, 0xc, 0x2c92bc0, 0x495f780)
        /go/src/github.com/influxdata/telegraf/config/config.go:1459 +0x3b8
github.com/influxdata/telegraf/config.(*Config).buildOutput(0xc0002842a0, 0xc000842160, 0x11, 0xc0000ac820, 0x0, 0x0, 0x0)
        /go/src/github.com/influxdata/telegraf/config/config.go:1395 +0x1c7
github.com/influxdata/telegraf/config.(*Config).addOutput(0xc0002842a0, 0xc000842160, 0x11, 0xc0000ac820, 0x0, 0x0)
        /go/src/github.com/influxdata/telegraf/config/config.go:1058 +0xf1
github.com/influxdata/telegraf/config.(*Config).LoadConfigData(0xc0002842a0, 0xc0005b4000, 0x50a, 0x70a, 0x70a, 0x0)
        /go/src/github.com/influxdata/telegraf/config/config.go:801 +0xbed
github.com/influxdata/telegraf/config.(*Config).LoadConfig(0xc0002842a0, 0x7fffe859984e, 0x1b, 0x1, 0x1)
        /go/src/github.com/influxdata/telegraf/config/config.go:728 +0x158
main.runAgent(0x3490f80, 0xc00002eac0, 0x4a8e4d0, 0x0, 0x0, 0x4a8e4d0, 0x0, 0x0, 0x0, 0x0)
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:127 +0x14b
main.reloadLoop(0x4a8e4d0, 0x0, 0x0, 0x4a8e4d0, 0x0, 0x0, 0xc00022dd08, 0x0, 0x0, 0xc00022dd08, ...)
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:110 +0x267
main.run(...)
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf_posix.go:7
main.main()
        /go/src/github.com/influxdata/telegraf/cmd/telegraf/telegraf.go:361 +0x71e

Additional info:

Seems like issue related with this bug:

I believe string should be corrected to

#...
c.getFieldDuration(tbl, "flush_jitter", &oc.FlushJitter)
#...

Metadata

Metadata

Assignees

Labels

bugunexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions