mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-03 22:52:30 +02:00
Ensure zipkin exporter reads and closes response body
This commit is contained in:
parent
d9b6d9c05d
commit
0e8fb1cb4f
@ -19,6 +19,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -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{}) {
|
||||
|
Loading…
Reference in New Issue
Block a user