influxdata / influxdata/telegraf

Fix contradictory debug messages in influxdb output

Open
#11,942 1 comment 0 reactions 1 assignee Claimed by @srebhan View on GitHub
area/influxdb bug
Dominant language
Go
Stars
17.8k
Forks
5.8k
Avg merge
1d 20h
Merged PRs (30d)
161

Description

When telegraf is configured to print debug level errors and the influxdb output is begin used, if there is a server error (or any HTTP 4xx response), telegraf prints two debug messages that contradict each other:

```
2022-10-04T22:20:23Z E! [outputs.influxdb] E! [outputs.influxdb] Failed to write metric (will be dropped: 401 Unauthorized):
2022-10-04T22:20:23Z D! [outputs.influxdb] Wrote batch of 15 metrics in 6.440209ms
```

The first one says metrics were dropped, the second says they were written.

Since the RunningOutput only prints the "Wrote batch" message when there's no error, maybe the output shouldn't return nil here
https://github.com/influxdata/telegraf/blob/bc2b32891103dbfb232a061e5255c3f5401edebd/plugins/outputs/influxdb/http.go#L390

and maybe it should return an APIError like it does for other cases:
https://github.com/influxdata/telegraf/blob/bc2b32891103dbfb232a061e5255c3f5401edebd/plugins/outputs/influxdb/http.go#L431

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.