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

NETOBSERV-1131: need to allow setting multiple filters #448

Merged
merged 2 commits into from Jul 5, 2023

Conversation

jotak
Copy link
Member

@jotak jotak commented Jun 29, 2023

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

Improve the promEncode API to allow setting multiple filters.
To avoid breaking change, the existing filter API is kept and marked as
deprecated.
@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Jun 29, 2023

@jotak: This pull request references NETOBSERV-1131 which is a valid jira issue.

In response to this:

Improve the promEncode API to allow setting multiple filters. To avoid breaking change, the existing filter API is kept and marked as deprecated.

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
Copy link

codecov bot commented Jun 30, 2023

Codecov Report

Merging #448 (70beefd) into main (44f6fd9) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            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     
Flag Coverage Δ
unittests 62.84% <100.00%> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
pkg/api/encode_prom.go 100.00% <100.00%> (ø)
pkg/pipeline/encode/encode_prom.go 78.02% <100.00%> (ø)

... and 1 file with indirect coverage changes

Comment on lines +53 to +57
func (i *PromMetricsItem) GetFilters() []PromMetricsFilter {
if len(i.Filters) == 0 && i.Filter.Key != "" {
return []PromMetricsFilter{i.Filter}
}
return i.Filters
Copy link
Collaborator

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

Suggested change
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

Copy link
Member Author

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")

Copy link
Collaborator

@jpinsonneau jpinsonneau left a 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

@openshift-ci-robot
Copy link
Collaborator

openshift-ci-robot commented Jul 3, 2023

@jotak: This pull request references NETOBSERV-1131 which is a valid jira issue.

In response to this:

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

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.

@jotak
Copy link
Member Author

jotak commented Jul 5, 2023

I'll merge this one as it isn't user facing without netobserv/network-observability-operator#387

@jotak
Copy link
Member Author

jotak commented Jul 5, 2023

/approve

@openshift-ci
Copy link

openshift-ci bot commented Jul 5, 2023

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Jul 5, 2023
@jotak jotak merged commit 8d40b32 into netobserv:main Jul 5, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants