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.
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:
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