Skip to content

Commit

Permalink
fix(httpclient): dont iterate over map
Browse files Browse the repository at this point in the history
  • Loading branch information
aldy505 committed Sep 3, 2024
1 parent 5f4c5ae commit 5214ea5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions httpclient/sentryhttpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ func (s *SentryRoundTripper) RoundTrip(request *http.Request) (*http.Response, e
cleanRequestURL := request.URL.Redacted()

span := sentry.StartSpan(ctx, "http.client", sentry.WithTransactionName(fmt.Sprintf("%s %s", request.Method, cleanRequestURL)))

for k, v := range s.tags {
span.SetTag(k, v)
}

span.Tags = s.tags
defer span.Finish()

span.SetData("http.query", request.URL.Query().Encode())
Expand Down
3 changes: 3 additions & 0 deletions httpclient/sentryhttpclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func TestIntegration(t *testing.T) {
Transaction: "GET https://example.com/foo",
Type: "transaction",
TransactionInfo: &sentry.TransactionInfo{Source: "custom"},
Tags: map[string]string{},
},
},
{
Expand All @@ -95,6 +96,7 @@ func TestIntegration(t *testing.T) {
Transaction: "GET https://example.com:443/foo/bar?baz=123#readme",
Type: "transaction",
TransactionInfo: &sentry.TransactionInfo{Source: "custom"},
Tags: map[string]string{},
},
},
{
Expand Down Expand Up @@ -142,6 +144,7 @@ func TestIntegration(t *testing.T) {
Transaction: "POST https://john:[email protected]:4321/secret",
Type: "transaction",
TransactionInfo: &sentry.TransactionInfo{Source: "custom"},
Tags: map[string]string{},
},
},
}
Expand Down

0 comments on commit 5214ea5

Please sign in to comment.