-
Notifications
You must be signed in to change notification settings - Fork 351
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
Provide option to collect custom metrics inside filters #384
Provide option to collect custom metrics inside filters #384
Conversation
👍 |
@lmineiro what do you think about this extension? |
This looks like one good start but I wouldn't leave it as it is. Although the metrics registry seems to be properly protected, the namespacing mentioned before is not. This can, potentially, lead to:
One simple way could be to always prefix a filter's key with the filter name, which already needs to be unique in the filter registry. What do you think? |
prefixing is a good point, i agree. It can be done in the proxy where it is iterating over the filters. |
filters/filters.go
Outdated
|
||
type FilterMetrics struct { | ||
Metrics *metrics.Metrics | ||
FilterName string |
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.
i would prefer not using this as a package visible field. Let me contemplate a bit on a different approach..
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.
you are right. I should have thought a bit more before pushing the code. With this code, I can easily change the FiilterName to whatever in the filters which we don't want to.
@lmineiro we applied the prefixing. Could you please check if it looks ok like this? |
👍 |
1 similar comment
👍 |
Now one can collect the custom metrics inside the filter using the methods defined in the filters.Metrics interface.
Mentioned in this issue #352
Please give your suggestions.
Following is the idea the PR implemented:
- MeasureSince(key, time)
- IncCounter(key)