influxdata / influxdata/influxdb

panic: runtime error: index out of range [0] with length 0 for Wavefront output in Telegraf

Open
#23,031 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

Hi,
I have a telegraf(in docker container in Kubernetes) based service sending continuous stream of metrics to Wavefront through wavefront proxy.

The telegraf service getting crashed often with the below error and stop sending metrics to wavefront.

We are pulling the latest version of telegraf taz in our service docker file as below:

RUN curl --output telegraf.tar.gz https://dl.influxdata.com/telegraf/releases/telegraf-1.20.4_linux_amd64.tar.gz RUN tar --strip-components=2 -C / -xvvf telegraf.tar.gz

Telegraf version is telegraf-1.20.4

panic: runtime error: index out of range [0] with length 0

goroutine 354 [running]:
github.com/wavefronthq/wavefront-sdk-go/senders.sanitizeInternal({0x0, 0x0})
	/go/pkg/mod/github.com/wavefronthq/wavefront-sdk-go@v0.9.7/senders/formatter.go:340 +0x2d5
github.com/wavefronthq/wavefront-sdk-go/senders.MetricLine({0xc00d09eb20, 0xc00b3f9b00}, 0xc00b3f9b00, 0x61ccb037, {0xc00db72900, 0x24}, 0x6000103, {0xc00083c000, 0x2a})
	/go/pkg/mod/github.com/wavefronthq/wavefront-sdk-go@v0.9.7/senders/formatter.go:56 +0x3ae
github.com/wavefronthq/wavefront-sdk-go/senders.(*directSender).SendMetric(0xc00081a0f0, {0xc00d09eb20, 0xc017249e30}, 0x40ead4, 0x0, {0xc00db72900, 0xfa00}, 0x0)
	/go/pkg/mod/github.com/wavefronthq/wavefront-sdk-go@v0.9.7/senders/direct.go:84 +0x48
github.com/influxdata/telegraf/plugins/outputs/wavefront.(*Wavefront).Write(0xc0007bf550, {0xc03e15e000, 0xfa0, 0x0})
	/go/src/github.com/influxdata/telegraf/plugins/outputs/wavefront/wavefront.go:172 +0x1dc
github.com/influxdata/telegraf/models.(*RunningOutput).write(0xc0002bd880, {0xc03e15e000, 0xfa0, 0xfa0})
	/go/src/github.com/influxdata/telegraf/models/running_output.go:244 +0x118
github.com/influxdata/telegraf/models.(*RunningOutput).WriteBatch(0xc0002bd880)
	/go/src/github.com/influxdata/telegraf/models/running_output.go:218 +0x58
github.com/influxdata/telegraf/agent.(*Agent).flushOnce.func1()
	/go/src/github.com/influxdata/telegraf/agent/agent.go:829 +0x29
created by github.com/influxdata/telegraf/agent.(*Agent).flushOnce
	/go/src/github.com/influxdata/telegraf/agent/agent.go:828 +0xb8

Note: Also this error is not resolved even with latest telegraf version 1.21.1

Please help us to resolve this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at plugins/outputs/wavefront/wavefront.go, especially Write, and inspect the wavefront-sdk-go formatter.go call to sanitizeInternal shown in the stack trace. Reproduce with the reported Telegraf versions and Wavefront output setup, then determine which empty input causes the panic. Done means the output no longer crashes and the failure has a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, kubernetes
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.