Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6b48923
feat: http client integration
aldy505 Aug 27, 2024
fd66575
chore(httpclient): variable naming according to linter
aldy505 Aug 27, 2024
439e98b
Merge branch 'master' into feat/httpclient
aldy505 Sep 3, 2024
5f4c5ae
chore: add changelog entry
aldy505 Sep 3, 2024
5214ea5
fix(httpclient): dont iterate over map
aldy505 Sep 3, 2024
ed105c1
feat(examples): add httpclient
aldy505 Sep 3, 2024
4e55daa
Merge branch 'master' into feat/httpclient
ribice Sep 3, 2024
15aa59a
feat(spans): only start 'http.client' op as a child span
aldy505 Sep 4, 2024
099dad4
chore: lint
aldy505 Sep 4, 2024
7d9555d
Merge branch 'master' into feat/httpclient
aldy505 Sep 15, 2024
f018dde
chore: remove GetSpanFromContext and replace it with SpanFromContext
aldy505 Oct 18, 2024
d6f2663
Merge branch 'master' into feat/httpclient
aldy505 Oct 18, 2024
6af10bf
feat(httpclient): use baggage and traceparent from hub
aldy505 Nov 2, 2024
c5ad7e4
Merge remote-tracking branch 'origin/master' into feat/httpclient
aldy505 Nov 2, 2024
081fc0b
feat(httpclient): trace propagation targets
aldy505 Nov 6, 2024
a3a6367
chore: remove trace options request
aldy505 Nov 16, 2024
2cb97af
Merge branch 'master' into feat/httpclient
aldy505 Nov 25, 2024
ce3d4ea
Merge branch 'master' into feat/httpclient
aldy505 Apr 23, 2025
1075de4
Update sentryhttpclient.go
aldy505 Apr 24, 2025
ae861f3
feat(httpclient): use WithDescription instead of WithTransactionName
aldy505 Apr 25, 2025
a5eb96f
Update _examples/httpclient/main.go
aldy505 Apr 28, 2025
791feb5
chore: lint errors
aldy505 May 2, 2025
c912fe9
chore: omit variable name
aldy505 May 2, 2025
3e9a23b
Merge branch 'master' into feat/httpclient
giortzisg May 2, 2025
912797f
Update CHANGELOG.md
cleptric May 6, 2025
0e21a00
Merge branch 'master' into feat/httpclient
cleptric May 6, 2025
b31001c
Merge branch 'master' into feat/httpclient
giortzisg Jun 3, 2025
389ca62
Merge branch 'master' into feat/httpclient
aldy505 Oct 23, 2025
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
Prev Previous commit
Next Next commit
feat(httpclient): use WithDescription instead of WithTransactionName
  • Loading branch information
aldy505 committed Apr 25, 2025
commit ae861f3b9443ae4744a1ec4a75a57f39b195cd06
2 changes: 1 addition & 1 deletion httpclient/sentryhttpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
tracePropagationTargets = clientOptions.TracePropagationTargets
}

}

Check failure on line 55 in httpclient/sentryhttpclient.go

View workflow job for this annotation

GitHub Actions / Lint

unnecessary trailing newline (whitespace)
}

t := &SentryRoundTripper{
Expand Down Expand Up @@ -106,7 +106,7 @@

cleanRequestURL := request.URL.Redacted()

span := parentSpan.StartChild("http.client", sentry.WithTransactionName(fmt.Sprintf("%s %s", request.Method, cleanRequestURL)))
span := parentSpan.StartChild("http.client", sentry.WithDescription(fmt.Sprintf("%s %s", request.Method, cleanRequestURL)))
defer span.Finish()

span.SetData("http.query", request.URL.Query().Encode())
Expand Down
79 changes: 40 additions & 39 deletions httpclient/sentryhttpclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@
"server.address": string("example.com"),
"server.port": string(""),
},
Name: "GET https://example.com/foo",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
Description: "GET https://example.com/foo",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
},
},
{
Expand All @@ -100,11 +100,11 @@
"server.address": string("example.com"),
"server.port": string("443"),
},
Name: "GET https://example.com:443/foo/bar?baz=123#readme",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
Description: "GET https://example.com:443/foo/bar?baz=123#readme",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
},
},
{
Expand All @@ -123,12 +123,11 @@
"server.address": string("example.com"),
"server.port": string("8443"),
},

Name: "HEAD https://example.com:8443/foo?bar=123&abc=def",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusInvalidArgument,
Description: "HEAD https://example.com:8443/foo?bar=123&abc=def",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusInvalidArgument,
},
},
{
Expand All @@ -146,11 +145,11 @@
"server.address": string("example.com"),
"server.port": string("4321"),
},
Name: "POST https://john:[email protected]:4321/secret",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
Description: "POST https://john:[email protected]:4321/secret",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
},
},
{
Expand All @@ -165,11 +164,11 @@
"server.address": string("example.com"),
"server.port": string(""),
},
Name: "POST https://example.com",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusInternalError,
Description: "POST https://example.com",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusInternalError,
},
},
{
Expand All @@ -194,11 +193,11 @@
"server.address": string("example.com"),
"server.port": string(""),
},
Name: "GET https://example.com/foo/bar?baz=123#readme",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
Description: "GET https://example.com/foo/bar?baz=123#readme",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
},
},
{
Expand All @@ -216,7 +215,7 @@
sentryClient, err := sentry.NewClient(sentry.ClientOptions{
EnableTracing: true,
TracesSampleRate: 1.0,
BeforeSendTransaction: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {

Check failure on line 218 in httpclient/sentryhttpclient_test.go

View workflow job for this annotation

GitHub Actions / Lint

unused-parameter: parameter 'hint' seems to be unused, consider removing or renaming it as _ (revive)
spansCh <- event.Spans
return event
},
Expand Down Expand Up @@ -271,7 +270,8 @@
cmpopts.IgnoreFields(
sentry.Span{},
"TraceID", "SpanID", "ParentSpanID", "StartTime", "EndTime",
"mu", "parent", "sampleRate", "ctx", "dynamicSamplingContext", "recorder", "finishOnce", "collectProfile", "contexts",
"mu", "parent", "sampleRate", "ctx", "dynamicSamplingContext", "recorder", "finishOnce", "contexts",
"explicitSampled",
),
}
for i, tt := range tests {
Expand Down Expand Up @@ -303,7 +303,7 @@
EnableTracing: true,
TracePropagationTargets: []string{"example.com"},
TracesSampleRate: 1.0,
BeforeSendTransaction: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {

Check failure on line 306 in httpclient/sentryhttpclient_test.go

View workflow job for this annotation

GitHub Actions / Lint

unused-parameter: parameter 'hint' seems to be unused, consider removing or renaming it as _ (revive)
spansCh <- event.Spans
return event
},
Expand Down Expand Up @@ -355,7 +355,8 @@
cmpopts.IgnoreFields(
sentry.Span{},
"TraceID", "SpanID", "ParentSpanID", "StartTime", "EndTime",
"mu", "parent", "sampleRate", "ctx", "dynamicSamplingContext", "recorder", "finishOnce", "collectProfile", "contexts",
"mu", "parent", "sampleRate", "ctx", "dynamicSamplingContext", "recorder", "finishOnce", "contexts",
"explicitSampled",
),
}

Expand All @@ -370,11 +371,11 @@
"server.address": string("example.com"),
"server.port": string(""),
},
Name: "POST https://example.com",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
Description: "POST https://example.com",
Op: "http.client",
Origin: "manual",
Sampled: sentry.SampledTrue,
Status: sentry.SpanStatusOK,
}

if diff := cmp.Diff(wantSpan, gotSpan, optstrans); diff != "" {
Expand All @@ -388,7 +389,7 @@
sentryClient, err := sentry.NewClient(sentry.ClientOptions{
EnableTracing: true,
TracesSampleRate: 1.0,
BeforeSendTransaction: func(event *sentry.Event, hint *sentry.EventHint) *sentry.Event {

Check failure on line 392 in httpclient/sentryhttpclient_test.go

View workflow job for this annotation

GitHub Actions / Lint

unused-parameter: parameter 'hint' seems to be unused, consider removing or renaming it as _ (revive)
spansCh <- event.Spans
return event
},
Expand Down Expand Up @@ -462,7 +463,7 @@
})

t.Run("Create a regular outgoing HTTP request with default SentryHttpClient", func(t *testing.T) {
client := sentryhttpclient.SentryHTTPClient
client := sentryhttpclient.Client

res, err := client.Head("https://sentry.io")
if err != nil {
Expand Down
Loading