Skip to content

Add metrics to deliverorderer#562

Open
liran-funaro wants to merge 2 commits intohyperledger:mainfrom
liran-funaro:bft-metrics
Open

Add metrics to deliverorderer#562
liran-funaro wants to merge 2 commits intohyperledger:mainfrom
liran-funaro:bft-metrics

Conversation

@liran-funaro
Copy link
Copy Markdown
Contributor

@liran-funaro liran-funaro commented May 6, 2026

Type of change

  • Improvement (improvement to code, performance, etc)

Description

  • Add metrics for BFT block puller
  • Improve metric doc extraction, also to extract sub-methods
  • Align all metrics sub-methods to a common signature to allow easy parsing

Related issues

@liran-funaro liran-funaro added the enhancement New feature or request label May 6, 2026
@liran-funaro liran-funaro requested a review from cendhu May 6, 2026 08:54
@coveralls
Copy link
Copy Markdown

coveralls commented May 6, 2026

Coverage Status

coverage: 91.321% (+0.06%) from 91.264% — liran-funaro:bft-metrics into hyperledger:main

Copy link
Copy Markdown
Contributor

@cendhu cendhu left a comment

Choose a reason for hiding this comment

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

Please try to avoid missing many things in a single PR. Smaller and focused PR would help to review and merge PRs quicker.

Comment on lines +44 to +45
Namespace: params.Namespace,
Subsystem: params.Subsystem,
Copy link
Copy Markdown
Contributor

@cendhu cendhu May 6, 2026

Choose a reason for hiding this comment

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

utils/deliverorderer is used only by the sidecar. Hence, I wonder whether we should keep it as utils or move them under sidecar so that we can have sidecar as the namespace. Is the orderer team planing to use this package?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think there is a plan to use this package in the Orderer.
But I still think it is best as a standalone package.

  1. It complements the deliver and delivercommitter packages.
  2. It can be used externally.
  3. It allows a flatter project structure.

Anyway, even if we include it under the sidecar package, it still makes sense to allow setting the namespace and subsystem by the user.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it still makes sense to allow setting the namespace and subsystem by the user.

Agreed.

But I still think it is best as a standalone package.

Now, it becomes unrelated to this PR. As deliverorder holds some of the core logic, I do feel now that it should belong to the sidecar similar to dependency graph. Most other packages in utils really sound like utilities without complex logics.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The "complex logic" is a strong point regarding not considering this as a utility.
We can address this in a different PR.

Comment thread .bob/rules/02-testing-guidelines.md Outdated
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
Copy link
Copy Markdown
Contributor

@cendhu cendhu left a comment

Choose a reason for hiding this comment

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

LGTM.

Comment thread utils/deliverorderer/metrics.go Outdated
d.targetArrivalTime = time.Now().Add(d.params.SuspicionGracePeriodPerBlock * gapDuration)
targetArrivalTimeUnix := float64(d.targetArrivalTime.Unix())
d.metrics.TargetArrivalDeadline.WithLabelValues(dataSourceIDLabel).Set(targetArrivalTimeUnix)
d.metrics.SuspicionRaisedTotal.WithLabelValues(dataSourceIDLabel).Inc()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we raising the suspicion before waiting for the arrival deadline to pass? Or should we also include SuspicionConfirmedTotal along with Raised and Cleared?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can add SuspicionConfirmedTotal. It can give valuable information.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added SuspicionConfirmedTotal and added a test case to verify this and the target deadline.
I also modified TargetArrivalDeadline to have millisecond granularity.

Comment thread utils/deliverorderer/orderer.go Outdated
Signed-off-by: Liran Funaro <liran.funaro@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bft-deliver] Add metrics

3 participants