-
Notifications
You must be signed in to change notification settings - Fork 23
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
NETOBSERV-1131: need to allow setting multiple filters #448
Conversation
Improve the promEncode API to allow setting multiple filters. To avoid breaking change, the existing filter API is kept and marked as deprecated.
@jotak: This pull request references NETOBSERV-1131 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
@@ Coverage Diff @@
## main #448 +/- ##
==========================================
+ Coverage 62.79% 62.84% +0.05%
==========================================
Files 96 96
Lines 6910 6915 +5
==========================================
+ Hits 4339 4346 +7
+ Misses 2326 2325 -1
+ Partials 245 244 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
func (i *PromMetricsItem) GetFilters() []PromMetricsFilter { | ||
if len(i.Filters) == 0 && i.Filter.Key != "" { | ||
return []PromMetricsFilter{i.Filter} | ||
} | ||
return i.Filters |
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.
Can't we just append i.Filter to i.Filters if specified ? So any config would work
func (i *PromMetricsItem) GetFilters() []PromMetricsFilter { | |
if len(i.Filters) == 0 && i.Filter.Key != "" { | |
return []PromMetricsFilter{i.Filter} | |
} | |
return i.Filters | |
func (i *PromMetricsItem) GetFilters() []PromMetricsFilter { | |
if i.Filter.Key != "" { | |
return append(i.Filters, i.Filter) | |
} | |
return i.Filters |
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.
that would allow weird configuration where people can use both the new and the deprecated fields ... the code looks simpler indeed, but in terms of config/ux I think I prefer not to allow weird things like that ("principle of least surprise")
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.
Small optionnal suggestion, LGTM in terms of code
@jotak: This pull request references NETOBSERV-1131 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I'll merge this one as it isn't user facing without netobserv/network-observability-operator#387
|
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jotak The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Improve the promEncode API to allow setting multiple filters. To avoid breaking change, the existing filter API is kept and marked as deprecated.
Operator PR: netobserv/network-observability-operator#387