Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] add headers to request #30685

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions exporter/zipkinexporter/zipkin.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func (ze *zipkinExporter) pushTraces(ctx context.Context, td ptrace.Traces) erro
if err != nil {
return fmt.Errorf("failed to push trace data via Zipkin exporter: %w", err)
}
for k, v := range ze.clientSettings.Headers {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment in our discussion in the issue, I don't think this PR is a valid update in its current form.

req.Header.Set(k, string(v))
}
req.Header.Set("Content-Type", ze.serializer.ContentType())

resp, err := ze.client.Do(req)
Expand Down
2 changes: 2 additions & 0 deletions exporter/zipkinexporter/zipkin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"bytes"
"context"
"fmt"
"go.opentelemetry.io/collector/config/configopaque"
"io"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -50,6 +51,7 @@ func TestZipkinExporter_roundtripJSON(t *testing.T) {
cfg := &Config{
HTTPClientSettings: confighttp.HTTPClientSettings{
Endpoint: cst.URL,
Headers: map[string]configopaque.String{"extra-header": "header-value"},
},
Format: "json",
}
Expand Down