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

Change init metrics black list #563

Merged
merged 3 commits into from
Aug 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions pkg/consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,9 @@ func (c *Consensus) reconfig(reconfig types.Reconfig) {
c.Logger.Panicf("Configuration is invalid, error: %v", err)
}

tmp := c.nodes
var newNodes []uint64
old := c.nodes
c.setNodes(reconfig.CurrentNodes)

OuterLoop:
for _, i := range c.nodes {
for _, j := range tmp {
if i == j {
continue OuterLoop
}
}
newNodes = append(newNodes, i)
}
c.Metrics.MetricsBlacklist.Initialize(newNodes)
c.initMetricsBlacklistReconfigure(old)

c.createComponents()
opts := algorithm.PoolOptions{
Expand Down Expand Up @@ -262,6 +251,21 @@ OuterLoop:
c.Logger.Debugf("Reconfig is done")
}

func (c *Consensus) initMetricsBlacklistReconfigure(old []uint64) {
var newNodes []uint64

OuterLoop:
for _, i := range c.nodes {
for _, j := range old {
if i == j {
continue OuterLoop
}
}
newNodes = append(newNodes, i)
}
c.Metrics.MetricsBlacklist.Initialize(newNodes)
}

func (c *Consensus) close() {
c.stopOnce.Do(
func() {
Expand Down