-
Notifications
You must be signed in to change notification settings - Fork 124
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-13111 disable new postgresql collectors. #3111
Merged
ademidoff
merged 12 commits into
main
from
PMM-13111-ability-to-disable-postgres-collectors
Aug 26, 2024
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
010932b
PMM-13111 disable new postgresql collectors.
BupycHuk 0f9f599
PMM-13111 Fix linters.
BupycHuk ea72e65
PMM-13111 Add license header.
BupycHuk ab43cde
Merge branch 'main' into PMM-13111-ability-to-disable-postgres-collec…
BupycHuk 7864cde
PMM-13111 Add comments.
BupycHuk f6fe4fb
PMM-13111 Add comments.
BupycHuk b26b9da
PMM-13111 Fix comments.
BupycHuk de688c7
Merge branch 'main' into PMM-13111-ability-to-disable-postgres-collec…
BupycHuk 971d727
PMM-13111 release notes.
BupycHuk fd8c09e
Update docs/release-notes/2.43.0.md
BupycHuk 2004583
Merge branch 'main' into PMM-13111-ability-to-disable-postgres-collec…
ademidoff 780f664
PMM-13111 fix a typo
ademidoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright (C) 2023 Percona LLC | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
||
package collectors | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDisableDefaultEnabledCollectors(t *testing.T) { | ||
type args struct { | ||
prefix string | ||
defaultCollectors []string | ||
disabledCollectors []string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want []string | ||
}{ | ||
{ | ||
name: "Disable single default enabled collectors", | ||
args: args{ | ||
prefix: "--no-collector.", | ||
defaultCollectors: []string{"a", "b", "c", "d", "e"}, | ||
disabledCollectors: []string{"b"}, | ||
}, | ||
want: []string{"--no-collector.b"}, | ||
}, | ||
{ | ||
name: "Disable multiple default enabled collectors", | ||
args: args{ | ||
prefix: "--no-collector.", | ||
defaultCollectors: []string{"a", "b", "c", "d", "e", "f"}, | ||
disabledCollectors: []string{"a", "c"}, | ||
}, | ||
want: []string{"--no-collector.a", "--no-collector.c"}, | ||
}, | ||
{ | ||
name: "Disable all default enabled collectors", | ||
args: args{ | ||
prefix: "--no-collector.", | ||
defaultCollectors: []string{"a", "b", "c"}, | ||
disabledCollectors: []string{"a", "b", "c"}, | ||
}, | ||
want: []string{"--no-collector.a", "--no-collector.b", "--no-collector.c"}, | ||
}, | ||
{ | ||
name: "Disable non-default enabled collectors", | ||
args: args{ | ||
prefix: "--no-collector.", | ||
defaultCollectors: []string{"a", "b", "c"}, | ||
disabledCollectors: []string{"d", "e", "f"}, | ||
}, | ||
want: []string{}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
actual := DisableDefaultEnabledCollectors(tt.args.prefix, tt.args.defaultCollectors, tt.args.disabledCollectors) | ||
require.Equal(t, tt.want, actual, "DisableDefaultEnabledCollectors() = %v, want %v", actual, tt.want) | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Considering we always use
--no-collector
as prefix for disabling collectors, should we just make it a constant and drop the prefix parameter?