-
-
Notifications
You must be signed in to change notification settings - Fork 223
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
feat: adds context to transaction. #962
Conversation
config.go
Outdated
@@ -149,7 +150,7 @@ func (c *wafConfig) WithDebugLogger(logger debuglog.Logger) WAFConfig { | |||
return ret | |||
} | |||
|
|||
func (c *wafConfig) WithErrorCallback(logger func(rule types.MatchedRule)) WAFConfig { | |||
func (c *wafConfig) WithErrorCallback(logger func(context.Context, types.MatchedRule)) WAFConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one option, another one is to add a method for retrieving the context in MatchedRule as proposed in #919 (comment) cc @anuraaga
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking up this request. As a package consumer this looks great - exactly what I was I hoping for. I guess it could always be a different additional function, something like
func WithContextErrorCallback(logger func(context.Context, types.MatchedRule)) WAFConfig
if you didn't want to it to be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has to be a breaking change anyways because the WAF is an interface and we decided not too long ago that changing that will require breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh yes - I missed that, thanks.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v4/main #962 +/- ##
==========================================
Coverage ? 82.54%
==========================================
Files ? 160
Lines ? 9013
Branches ? 0
==========================================
Hits ? 7440
Misses ? 1324
Partials ? 249
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Superseed by #963 |
Follows #919