Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e544314
feat: initial sentrysql implementation
aldy505 Oct 18, 2024
92e3a6b
chore: resolve a few lint issues
aldy505 Oct 18, 2024
aa4acb2
chore: another attempt at resolving lint issues
aldy505 Oct 18, 2024
a6b5de8
chore: wrong method name
aldy505 Oct 18, 2024
c6ebbda
chore: another attempt of fixing lint issues
aldy505 Oct 18, 2024
63413f3
feat: implement missing bits from driver interfaces
aldy505 Oct 19, 2024
b77e392
chore: missing a period on comment
aldy505 Oct 19, 2024
9b59328
test: replace ramsql with in-memory sqlite
aldy505 Oct 19, 2024
7ecd868
test: common queries
aldy505 Oct 19, 2024
19c97df
chore: avoid cyclo errors
aldy505 Oct 19, 2024
d9073aa
test: no parent span
aldy505 Oct 19, 2024
05d699b
test: db.Driver
aldy505 Oct 19, 2024
0fc642e
chore: trailing newline
aldy505 Oct 19, 2024
7b5fbb5
test: using mysql server for connector
aldy505 Oct 19, 2024
93198bd
test: remove mysql server, stay on go1.18
aldy505 Oct 19, 2024
ab1d3bf
chore: another go1.18 rollback
aldy505 Oct 19, 2024
18d5f66
test: NewSentrySQLConnector
aldy505 Oct 26, 2024
3e31bb5
chore(example): sql integration example
aldy505 Oct 26, 2024
fbd4dfc
chore: don't lint fakedb
aldy505 Oct 26, 2024
1023392
test: backport to go1.18
aldy505 Oct 26, 2024
2dc58a5
test: backport to go1.18
aldy505 Oct 26, 2024
c5fa49d
chore: lint
aldy505 Oct 26, 2024
a6e4fd4
Merge remote-tracking branch 'origin/master' into feat/sentrysql
aldy505 Nov 2, 2024
1f38b9f
test(sentrysql): test against legacy driver
aldy505 Nov 2, 2024
f173533
chore(sentrysql): remove unvisited context check
aldy505 Nov 2, 2024
bcc99fc
chore: lint
aldy505 Nov 2, 2024
38ba84c
chore(sentrysql): make sure we implement required interfaces
aldy505 Nov 6, 2024
31ef60f
Merge branch 'master' into feat/sentrysql
aldy505 Nov 25, 2024
2802546
Merge remote-tracking branch 'origin/master' into feat/sentrysql
aldy505 Apr 25, 2025
0020dcc
ref(sentrysql): don't return ErrSkip for conn.QueryContext and conn.E…
aldy505 Apr 25, 2025
7cd3b58
ref: move sentrysql to dedicated module
aldy505 Apr 25, 2025
3178fa9
ref(sentrysql): set context before accesing non-context methods
aldy505 Apr 25, 2025
9b12d0a
test(sentrysql): check for received and want spans before observing t…
aldy505 May 7, 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
1 change: 0 additions & 1 deletion sentrysql/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ require (
github.com/go-sql-driver/mysql v1.8.1
github.com/google/go-cmp v0.5.9
github.com/lib/pq v1.10.9

)

require (
Expand Down
84 changes: 84 additions & 0 deletions sentrysql/sentrysql_connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,18 @@ func TestNewSentrySQLConnector_Integration(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

Comment on lines +131 to +142
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we not have tt.WantSpans as a []Span so that we can compare immediately with gotSpans? I'd say that it's not very readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some rounds with this, I can't get []Span comparison working (problems with google/go-cmp package). Is it okay if we backlog this somehow?

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down Expand Up @@ -229,6 +241,18 @@ func TestNewSentrySQLConnector_Integration(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down Expand Up @@ -395,6 +419,18 @@ func TestNewSentrySQLConnector_Conn(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down Expand Up @@ -506,6 +542,18 @@ func TestNewSentrySQLConnector_Conn(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down Expand Up @@ -661,6 +709,18 @@ func TestNewSentrySQLConnector_BeginTx(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down Expand Up @@ -1010,6 +1070,18 @@ func TestNewSentrySQLConnector_PrepareContext(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down Expand Up @@ -1127,6 +1199,18 @@ func TestNewSentrySQLConnector_PrepareContext(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down
49 changes: 49 additions & 0 deletions sentrysql/sentrysql_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,18 @@ func TestNewSentrySQLLegacy_Integration(t *testing.T) {
gotSpans := got[i]

var diffs []string
// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
diffs = append(diffs, diff)
Expand Down Expand Up @@ -238,6 +250,18 @@ func TestNewSentrySQLLegacy_Integration(t *testing.T) {
gotSpans := got[i]

var diffs []string
// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
diffs = append(diffs, diff)
Expand Down Expand Up @@ -411,7 +435,20 @@ func TestNewSentrySQLLegacy_Conn(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string

for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
diffs = append(diffs, diff)
Expand Down Expand Up @@ -527,6 +564,18 @@ func TestNewSentrySQLLegacy_Conn(t *testing.T) {
var foundMatch = false
gotSpans := got[i]

// if WantSpan is nil, yet we got some spans, it should be an error
if tt.WantSpan == nil {
t.Errorf("Expecting no spans, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

// if WantSpan is not nil, we should have at least one span
if len(gotSpans) == 0 {
t.Errorf("Expecting at least one span, but got %d spans: %v", len(gotSpans), gotSpans)
continue
}

var diffs []string
for _, gotSpan := range gotSpans {
if diff := cmp.Diff(tt.WantSpan, gotSpan, optstrans); diff != "" {
Expand Down
Loading