Skip to content

Commit

Permalink
Merge pull request #788 from Aneurysm9/OTG-786
Browse files Browse the repository at this point in the history
Ensure zipkin exporter reads and closes response body
  • Loading branch information
MrAlias authored Jun 2, 2020
2 parents d9b6d9c + 0e8fb1c commit 1ed9058
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions exporters/trace/zipkin/zipkin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -112,6 +113,16 @@ func (e *Exporter) ExportSpans(ctx context.Context, batch []*export.SpanData) {
return
}
e.logf("zipkin responded with status %d", resp.StatusCode)

_, err = ioutil.ReadAll(resp.Body)
if err != nil {
e.logf("failed to read response body: %v", err)
}

err = resp.Body.Close()
if err != nil {
e.logf("failed to close response body: %v", err)
}
}

func (e *Exporter) logf(format string, args ...interface{}) {
Expand Down

0 comments on commit 1ed9058

Please sign in to comment.