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

[Fix] Configure metrics compilation in root toml #3462

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

niklaslong
Copy link
Collaborator

@niklaslong niklaslong commented Jan 6, 2025

The cli crate currently enables metrics as a default feature, this PR moves the feature's configuration to the root level toml, enables it by default and introduces a metrics feature on cli. In addition, snarks-node-metrics is made optional.

Correct configuration can be verified with a reverse-search for the metrics crate by feature:

  • cargo tree -e features -i snarkos-node-metrics (which should show matches, metrics being enabled by default)
  • cargo tree -e features -i snarkos-node-metrics --no-default-features (which should show no matches)

Fixes #3379.

The last commit realigns the dependencies in the tcp crate, lmk if I should drop it or move it someplace else.

Edit: prometheus metric sanity check was also successful with a small devnet.

@niklaslong niklaslong marked this pull request as draft January 6, 2025 15:27
@@ -56,7 +56,7 @@ name = "snarkos"
path = "snarkos/main.rs"

[features]
metrics = [ "snarkos-node-metrics", "snarkos-node/metrics" ]
default = [ "snarkos-node-metrics", "snarkos-node/metrics", "snarkos-cli/metrics" ]
Copy link
Collaborator Author

@niklaslong niklaslong Jan 6, 2025

Choose a reason for hiding this comment

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

Adding snarkos-cli/metrics here isn't strictly necessary for the feature to be compiled in (as they are additive across shared dependencies) but it is more complete.

Copy link
Contributor

@vicsn vicsn left a comment

Choose a reason for hiding this comment

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

LGTM! Want to un-draft, and mention in the PR message as well the result of a sanity check: compile snarkOS, run a small local devnet using devnet.sh and see if the /metrics endpoint has non-zero outputs.

@niklaslong niklaslong marked this pull request as ready for review January 7, 2025 12:56
@niklaslong
Copy link
Collaborator Author

niklaslong commented Jan 7, 2025

Done, sanity check sample output from the devnet prometheus metrics:

# TYPE snarkos_bft_leaders_elected_total counter
snarkos_bft_leaders_elected_total 169

# TYPE snarkos_bft_connecting_total gauge
snarkos_bft_connecting_total 1

# TYPE snarkos_bft_primary_certified_batches gauge
snarkos_bft_primary_certified_batches 215

# TYPE snarkos_blocks_coinbase_target gauge
snarkos_blocks_coinbase_target 536870911

# TYPE snarkos_bft_last_committed_round gauge
snarkos_bft_last_committed_round 220

@niklaslong niklaslong changed the title Fix: configure metrics compilation in root toml [Fix] Configure metrics compilation in root toml Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Clean up metrics feature flag
2 participants