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

contrib/gocql/gocql: add WithErrorCheck #1316

Merged
merged 1 commit into from
Jun 30, 2022
Merged

Conversation

ufoot
Copy link
Member

@ufoot ufoot commented Jun 1, 2022

Some cassandra services report a super high level of errors, when it's only queries returning no data because the selectors do not match. As show in the example, if you just SELECT ... something that is not in the DB -> returns as an error.

This only happens when using Scan though, using an iterator, the "problem" does not surface.

The patch uses ideas from #1314 and #1315 or #940 (already merged) and introduces a WithErrorCheck option with allows callers to consider that some errors should not be reported by APM.

A typical override would look like:

tq := WrapQuery(q,
		WithServiceName("TestServiceName"),
		WithErrorCheck(func(err error) bool { return err != gocql.ErrNotFound }))

@ufoot ufoot requested a review from a team June 1, 2022 10:08
@gbbr gbbr changed the title [gocql] consider ErrNotFound as an acceptable error contrib/gocql/gocql: consider ErrNotFound as an acceptable error Jun 2, 2022
contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

This is all good, but we need to apply the change differently.

contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql_test.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql_test.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/gocql_test.go Outdated Show resolved Hide resolved
contrib/gocql/gocql/option.go Show resolved Hide resolved
gbbr
gbbr previously approved these changes Jun 30, 2022
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

Thanks Christian 🙏🏻

@gbbr gbbr changed the title contrib/gocql/gocql: consider ErrNotFound as an acceptable error contrib/gocql/gocql: add WithErrorCheck Jun 30, 2022
@gbbr gbbr added this to the 1.39.0 milestone Jun 30, 2022
@ufoot ufoot force-pushed the christian/gocql-errnotfound branch from 866debf to c41796b Compare June 30, 2022 12:19
@gbbr gbbr merged commit 76d6949 into main Jun 30, 2022
@gbbr gbbr deleted the christian/gocql-errnotfound branch June 30, 2022 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants