From 7bc722623914d1eee82c98ae518667c0385599ab Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Thu, 12 Dec 2024 18:02:19 +0100 Subject: [PATCH] cleanup --- dynamic_sampling_context_test.go | 3 --- interfaces.go | 4 ---- interfaces_test.go | 3 +-- scope_test.go | 4 ++-- slog/converter_test.go | 1 - 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/dynamic_sampling_context_test.go b/dynamic_sampling_context_test.go index bb636a061..4ed8e5fcf 100644 --- a/dynamic_sampling_context_test.go +++ b/dynamic_sampling_context_test.go @@ -87,9 +87,6 @@ func TestDynamicSamplingContextFromTransaction(t *testing.T) { Release: "1.0.0", Environment: "test", }) - hubFromContext(ctx).ConfigureScope(func(scope *Scope) { - scope.SetUser(User{Segment: "user_segment"}) - }) txn := StartTransaction(ctx, "name", WithTransactionSource(SourceCustom)) txn.TraceID = TraceIDFromHex("d49d9bf66f13450b81f65bc51cf49c03") return txn diff --git a/interfaces.go b/interfaces.go index 5d5332ab7..8df250477 100644 --- a/interfaces.go +++ b/interfaces.go @@ -136,10 +136,6 @@ func (u User) IsEmpty() bool { return false } - if u.Segment != "" { - return false - } - if len(u.Data) > 0 { return false } diff --git a/interfaces_test.go b/interfaces_test.go index 84e30d9da..c7f3195dc 100644 --- a/interfaces_test.go +++ b/interfaces_test.go @@ -31,9 +31,8 @@ func TestUserIsEmpty(t *testing.T) { {input: User{IPAddress: "127.0.0.1"}, want: false}, {input: User{Username: "My Username"}, want: false}, {input: User{Name: "My Name"}, want: false}, - {input: User{Segment: "My Segment"}, want: false}, {input: User{Data: map[string]string{"foo": "bar"}}, want: false}, - {input: User{ID: "foo", Email: "foo@example.com", IPAddress: "127.0.0.1", Username: "My Username", Name: "My Name", Segment: "My Segment", Data: map[string]string{"foo": "bar"}}, want: false}, + {input: User{ID: "foo", Email: "foo@example.com", IPAddress: "127.0.0.1", Username: "My Username", Name: "My Name", Data: map[string]string{"foo": "bar"}}, want: false}, } for _, test := range tests { diff --git a/scope_test.go b/scope_test.go index b056f5fbc..2eee4259c 100644 --- a/scope_test.go +++ b/scope_test.go @@ -57,9 +57,9 @@ func fillEventWithData(event *Event) *Event { func TestScopeSetUser(t *testing.T) { scope := NewScope() - scope.SetUser(User{ID: "foo", Email: "foo@example.com", IPAddress: "127.0.0.1", Username: "My Username", Name: "My Name", Segment: "My Segment", Data: map[string]string{"foo": "bar"}}) + scope.SetUser(User{ID: "foo", Email: "foo@example.com", IPAddress: "127.0.0.1", Username: "My Username", Name: "My Name", Data: map[string]string{"foo": "bar"}}) - assertEqual(t, User{ID: "foo", Email: "foo@example.com", IPAddress: "127.0.0.1", Username: "My Username", Name: "My Name", Segment: "My Segment", Data: map[string]string{"foo": "bar"}}, scope.user) + assertEqual(t, User{ID: "foo", Email: "foo@example.com", IPAddress: "127.0.0.1", Username: "My Username", Name: "My Name", Data: map[string]string{"foo": "bar"}}, scope.user) } func TestScopeSetUserOverrides(t *testing.T) { diff --git a/slog/converter_test.go b/slog/converter_test.go index e664f26b1..3b89bc558 100644 --- a/slog/converter_test.go +++ b/slog/converter_test.go @@ -108,7 +108,6 @@ func TestAttrToSentryEvent(t *testing.T) { IPAddress: "user_ip_address", Username: "user_username", Name: "user_name", - Segment: "user_segment", Data: map[string]string{}, }, },