-
Notifications
You must be signed in to change notification settings - Fork 51
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
Create the config and namespace filterer #457
Conversation
5dbcaa2
to
ac1c7bb
Compare
ac1c7bb
to
2f03281
Compare
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.
Great job so far! I left some comments, mostly nits.
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.
LGTM, thanks for addressing the comments 👍
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.
looks really good, i lefts some questions and comments
// NamespaceFilterer provides an interface to filter namespaces. | ||
type NamespaceFilterer interface { | ||
IsAllowed(namespace string) bool | ||
} |
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 wonder if this interface is too specific. What would be the advantage of having a filter specific to namespaces, as opposed to a filter that takes in fetch.RawMetrics
and returns a bool? NamespaceFilter
could be a particular implementation of this, looking for metrics["namespace"]
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're right, I updated the interface definition and implementation here e57ba69.
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.
After talking with @alvarocabanas and @sigilioso, we decided to move back again to the initial definition. Implementing the solution suggested above would imply some refactor in order to avoid cyclic dependencies between definition and discovery packages and to make the code maintainable.
Done in 95f8b9d.
We can talk about this when you come back 🙂
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.
LGTM
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.
LGTM
Closes https://github.com/newrelic/newrelic-coreint/issues/324.
Filtering namespaces basically works this way:
namespaceSelector.matchLabels
.namespaceSelector.matchExpressions
(You can check as well https://pkg.go.dev/k8s.io/apimachinery/pkg/labels#Parse)For more in depth details about the final solution, take a look at this internal doc.