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

refactoring metrics #564

Merged
merged 2 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions internal/bft/requestpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (rp *Pool) Submit(request []byte) error {

if uint64(len(request)) > rp.options.RequestMaxBytes {
rp.metrics.CountOfFailAddRequestToPool.With(
rp.metrics.LabelsForWith(api.NameReasonFailAdd, api.ReasonRequestMaxBytes)...,
rp.metrics.LabelsForWith("reason", api.ReasonRequestMaxBytes)...,
).Add(1)
return fmt.Errorf(
"submitted request (%d) is bigger than request max bytes (%d)",
Expand Down Expand Up @@ -217,7 +217,7 @@ func (rp *Pool) Submit(request []byte) error {
// do not wait for a semaphore with a lock, as it will prevent draining the pool.
if err := rp.semaphore.Acquire(ctx, 1); err != nil {
rp.metrics.CountOfFailAddRequestToPool.With(
rp.metrics.LabelsForWith(api.NameReasonFailAdd, api.ReasonSemaphoreAcquireFail)...,
rp.metrics.LabelsForWith("reason", api.ReasonSemaphoreAcquireFail)...,
).Add(1)
return errors.Wrapf(err, "acquiring semaphore for request: %s", reqInfo)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/bft/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func (bl blacklist) computeUpdate() []uint64 {
for _, node := range bl.nodes {
inBlacklist := newBlacklistMap[node]
bl.metricsBlacklist.NodesInBlackList.With(
bl.metricsBlacklist.LabelsForWith(api.NameBlackListNodeID, strconv.FormatUint(node, 10))...,
bl.metricsBlacklist.LabelsForWith("blackid", strconv.FormatUint(node, 10))...,
).Set(btoi(inBlacklist))
}
bl.metricsBlacklist.CountBlackList.Set(float64(len(newBlacklist)))
Expand Down
Loading