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

fix(tracing): Add WithTransactionSource() span option, deprecate TransctionSource() #611

Merged
merged 3 commits into from Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions dynamic_sampling_context_test.go
Expand Up @@ -90,7 +90,7 @@ func TestDynamicSamplingContextFromTransaction(t *testing.T) {
hubFromContext(ctx).ConfigureScope(func(scope *Scope) {
scope.SetUser(User{Segment: "user_segment"})
})
txn := StartTransaction(ctx, "name", TransctionSource(SourceCustom))
txn := StartTransaction(ctx, "name", WithTransactionSource(SourceCustom))
txn.TraceID = TraceIDFromHex("d49d9bf66f13450b81f65bc51cf49c03")
return txn
}(),
Expand All @@ -116,7 +116,7 @@ func TestDynamicSamplingContextFromTransaction(t *testing.T) {
Dsn: "http://public@example.com/sentry/1",
Release: "1.0.0",
})
txn := StartTransaction(ctx, "name", TransctionSource(SourceURL))
txn := StartTransaction(ctx, "name", WithTransactionSource(SourceURL))
txn.TraceID = TraceIDFromHex("d49d9bf66f13450b81f65bc51cf49c03")
return txn
}(),
Expand Down
2 changes: 1 addition & 1 deletion http/sentryhttp.go
Expand Up @@ -89,7 +89,7 @@ func (h *Handler) handle(handler http.Handler) http.HandlerFunc {
options := []sentry.SpanOption{
sentry.OpName("http.server"),
sentry.ContinueFromRequest(r),
sentry.TransctionSource(sentry.SourceURL),
sentry.WithTransactionSource(sentry.SourceURL),
}
// We don't mind getting an existing transaction back so we don't need to
// check if it is.
Expand Down
8 changes: 7 additions & 1 deletion tracing.go
Expand Up @@ -801,8 +801,14 @@
}

// TransctionSource sets the source of the transaction name.
// TODO(anton): Fix the typo.
//
// Deprecated: Use WithTransactionSource() instead.
func TransctionSource(source TransactionSource) SpanOption {
return WithTransactionSource(source)

Check warning on line 807 in tracing.go

View check run for this annotation

Codecov / codecov/patch

tracing.go#L807

Added line #L807 was not covered by tests
}

// WithTransactionSource sets the source of the transaction name.
func WithTransactionSource(source TransactionSource) SpanOption {
return func(s *Span) {
s.Source = source
}
Expand Down