Skip to content

Commit

Permalink
[exporter/influxdb] Remove //nolint indent-error-flow (open-telemetry…
Browse files Browse the repository at this point in the history
  • Loading branch information
yukinakanaka authored and jmsnll committed Nov 12, 2023
1 parent c83ced0 commit 315b146
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions exporter/influxdbexporter/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,24 @@ func (b *influxHTTPWriterBatch) WriteBatch(ctx context.Context) error {
return consumererror.NewPermanent(err)
}

if res, err := b.httpClient.Do(req); err != nil {
res, err := b.httpClient.Do(req)
if err != nil {
return err
} else if body, err := io.ReadAll(res.Body); err != nil {
}
body, err := io.ReadAll(res.Body)
if err != nil {
return err
} else if err = res.Body.Close(); err != nil {
}
if err = res.Body.Close(); err != nil {
return err
} else { // nolint indent-error-flow
switch res.StatusCode / 100 {
case 2: // Success
break
case 5: // Retryable error
return fmt.Errorf("line protocol write returned %q %q", res.Status, string(body))
default: // Terminal error
return consumererror.NewPermanent(fmt.Errorf("line protocol write returned %q %q", res.Status, string(body)))
}
}
switch res.StatusCode / 100 {
case 2: // Success
break
case 5: // Retryable error
return fmt.Errorf("line protocol write returned %q %q", res.Status, string(body))
default: // Terminal error
return consumererror.NewPermanent(fmt.Errorf("line protocol write returned %q %q", res.Status, string(body)))
}

return nil
Expand Down

0 comments on commit 315b146

Please sign in to comment.