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

PMM-10072 Filter out profiler collection #589

Closed

Conversation

ShashankSinha252
Copy link
Contributor

@ShashankSinha252 ShashankSinha252 commented Nov 7, 2022

PMM-10072 Filter out profiler collection for monitoring

@ShashankSinha252 ShashankSinha252 requested a review from a team as a code owner November 7, 2022 10:12
@ShashankSinha252 ShashankSinha252 requested review from tshcherban and JiriCtvrtka and removed request for a team November 7, 2022 10:12
var systemDBs = []string{"admin", "config", "local"} //nolint:gochecknoglobals
var (
systemDBs = []string{"admin", "config", "local"} //nolint:gochecknoglobals
systemCollections = []string{"system.profile"}
Copy link

Choose a reason for hiding this comment

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

🚫 [golangci-lint] reported by reviewdog 🐶
systemCollections is a global variable (gochecknoglobals)

return collections, nil
filteredCollections := []string{}
for _, collection := range collections {
if collection == systemCollections[0] {
Copy link
Contributor

Choose a reason for hiding this comment

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

if there is only one element in the systemCollections slice, could we use it as a constant variable?

Or if you plan to add more elements to systemCollections slice later could you please write this code which will work if the slice has two or more elements, but not only one?

var (
systemDBs = []string{"admin", "config", "local"} //nolint:gochecknoglobals
systemCollections = []string{"system.profile"}
)

func listCollections(ctx context.Context, client *mongo.Client, database string, filterInNamespaces []string) ([]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is it possible to add tests for the new behavior of filtering collections?

exporter/common.go Show resolved Hide resolved
exporter/common.go Show resolved Hide resolved
@BupycHuk
Copy link
Member

closing it as it was done in #917

@BupycHuk BupycHuk closed this Nov 14, 2024
@BupycHuk BupycHuk deleted the PMM-10072-reduce-permissions-requirements branch November 14, 2024 16:35
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.

4 participants