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

feat: adds context to transaction. #962

Closed
wants to merge 3 commits into from

Conversation

jcchavezs
Copy link
Member

Follows #919

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 {
Copy link
Member Author

@jcchavezs jcchavezs Jan 24, 2024

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

Copy link

@MrWako MrWako Jan 25, 2024

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.

Copy link
Member Author

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.

Copy link

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.

@jcchavezs jcchavezs changed the title feat: adds context to transaction. [DRAFT] feat: adds context to transaction. Jan 25, 2024
@jcchavezs jcchavezs marked this pull request as draft January 25, 2024 14:42
@jcchavezs jcchavezs changed the title [DRAFT] feat: adds context to transaction. feat: adds context to transaction. Jan 25, 2024
Copy link

codecov bot commented Jan 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (v4/main@90fbf03). Click here to learn what that means.

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           
Flag Coverage Δ
default 77.62% <0.00%> (?)
examples 26.64% <0.00%> (?)
ftw 47.04% <0.00%> (?)
ftw-multiphase 49.23% <0.00%> (?)
tinygo 75.02% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jcchavezs
Copy link
Member Author

Superseed by #963

@jcchavezs jcchavezs closed this Jan 26, 2024
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.

2 participants