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 metrics support. #29

Merged
merged 14 commits into from
Oct 7, 2022
Merged

feat: adds metrics support. #29

merged 14 commits into from
Oct 7, 2022

Conversation

jcchavezs
Copy link
Member

@jcchavezs jcchavezs commented Oct 5, 2022

This PR adds support for metrics. The main challenge for me was to come up with the right design, from named return values and defer to return wrapping methods, this is the best design I could come up.

Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Probably should have asked what metrics you're planning sooner 😅

Getting times in wasm is unfortunately fairly expensive so I don't think we can do it by default - one of those cause more harm than help type of situations. The print timings thing is flagged off because of that. Timing per phase is also sort of a performance tuning tool so I don't think it's as important and can be designed in more detail, we should consider adding it to the SDK instead as an extension of tetratelabs/proxy-wasm-go-sdk#327 rather than waf-specific. But if we did want something short-term, it should just be added to the existing function which is flag guarded rather than adding this new wrapper.

The most important metric for WAF seems to be interruption, so I would trim down this PR to just that single metric, it can be added to handleInterruption which can be modified to take a phase parameter if the interruption doesn't already provide that.

@jcchavezs
Copy link
Member Author

Do you mind reviewing it again @anuraaga ?

@anuraaga
Copy link
Contributor

anuraaga commented Oct 7, 2022

Looks good except for one comment on build file

example/envoy-config.yaml Outdated Show resolved Hide resolved
magefile.go Outdated Show resolved Hide resolved
@jcchavezs jcchavezs merged commit 988df77 into main Oct 7, 2022
@jcchavezs jcchavezs deleted the metrics branch October 7, 2022 10: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.

2 participants