mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/promscrape: follow-up after eabcfc9bcd
`-promscrape.cluster.membersCount` by default should be `1`, like every
single vmagent is a cluster of one member on its own.
The change additionally validates that user can't set `-promscrape.cluster.membersCount`
to value lower than `1`.
eabcfc9bcd
Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
685c3d95e7
commit
d70b346623
2 changed files with 5 additions and 1 deletions
|
@ -83,7 +83,10 @@ func mustInitClusterMemberID() {
|
|||
if err != nil {
|
||||
logger.Fatalf("cannot parse -promscrape.cluster.memberNum=%q: %s", *clusterMemberNum, err)
|
||||
}
|
||||
if n < 0 || (*clusterMembersCount != 0 && n >= *clusterMembersCount) {
|
||||
if *clusterMembersCount < 1 {
|
||||
logger.Fatalf("-promscrape.cluster.membersCount can't be lower than 1: got %d", *clusterMembersCount)
|
||||
}
|
||||
if n < 0 || n >= *clusterMembersCount {
|
||||
logger.Fatalf("-promscrape.cluster.memberNum must be in the range [0..%d] according to -promscrape.cluster.membersCount=%d",
|
||||
*clusterMembersCount, *clusterMembersCount)
|
||||
}
|
||||
|
|
|
@ -123,6 +123,7 @@ func TestNeedSkipScrapeWork(t *testing.T) {
|
|||
}
|
||||
// Disabled clustering
|
||||
f("foo", 0, 0, 0, false)
|
||||
f("foo", 0, 0, 1, false)
|
||||
|
||||
// A cluster with 2 nodes with disabled replication
|
||||
f("foo", 2, 0, 0, true)
|
||||
|
|
Loading…
Reference in a new issue