Skip to content

Commit

Permalink
fix(tracing): Add WithTransactionSource() span option, deprecate Tran…
Browse files Browse the repository at this point in the history
…sctionSource() (#611)
  • Loading branch information
tonyo committed Apr 11, 2023
1 parent 9f9f913 commit e70db81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
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 @@ func OpName(name string) SpanOption {
}

// 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)
}

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

0 comments on commit e70db81

Please sign in to comment.