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

feat(core): add metrics/observability with prometheus #1518

Merged
merged 22 commits into from
Jan 3, 2025

Conversation

fborello-lambda
Copy link
Contributor

@fborello-lambda fborello-lambda commented Dec 16, 2024

Motivation

We need a starting point to create dashboards with Grafana. Metrics are essential to observe the behavior of the node.

Description

  • Simple dashboard with a counter. Counts the transactions.

    • We neeed an API with the /metrics endpoint → using axum for fast development, we may want to create a simple API from scratch without any crate.
  • To test it out:

  1. cd crates/l2 && cp .env.example .env
  2. make rm-db-l2 && make init
  • In a new terminal:
  1. cd crates/l2 && make cli
  2. ethrex_l2 test load --path <full_path>/ethrex/test_data/private_keys.txt -i 1
  • In the browser go to http://localhost:3802/:
    • Login with admin/admin
    • Go to Dashboards → open the Ethrex - Transactions dashboard, the dashboard should show 172. The previous cli's command sent 172 transactions.

Example output:

image

Closes #1429

wip

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello
@fborello-lambda fborello-lambda self-assigned this Dec 16, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello
@fborello-lambda fborello-lambda marked this pull request as ready for review December 17, 2024 20:47
@fborello-lambda fborello-lambda requested a review from a team as a code owner December 17, 2024 20:47
cmd/ethrex/ethrex.rs Outdated Show resolved Hide resolved
fborello-lambda and others added 12 commits December 18, 2024 10:48

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello
…ex into core/prometheus_grafana

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
cmd/ethrex/ethrex.rs Outdated Show resolved Hide resolved

prometheus = "0.13.4"

# TODO: remove?
Copy link
Contributor

Choose a reason for hiding this comment

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

What should we do about this TODO?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left that TODO in case we want an api made by ourselves, do you think we can remove the comment?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not removed, but updated with this context

Copy link
Contributor

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

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

LGTM. Left a comment and a suggestion. We can merge after resolving those.

fborello-lambda and others added 2 commits January 3, 2025 11:29

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>

Verified

This commit was signed with the committer’s verified signature. The key has expired.
fborello-lambda Federico Borello
@fborello-lambda
Copy link
Contributor Author

I have to change it back to *"0" to fix the clippy warning:

   if metrics_port != "0".to_owned() {
    |                        ^^^^^^^^^^^^^^ help: try: `*"0"`

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@ilitteri ilitteri enabled auto-merge January 3, 2025 17:35
@ilitteri ilitteri disabled auto-merge January 3, 2025 17:35
@ilitteri ilitteri enabled auto-merge January 3, 2025 18:09
@ilitteri ilitteri added this pull request to the merge queue Jan 3, 2025
Merged via the queue into main with commit c5dee10 Jan 3, 2025
16 of 17 checks passed
@ilitteri ilitteri deleted the core/prometheus_grafana branch January 3, 2025 18:25
LeanSerra added a commit that referenced this pull request Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prometheus and Grafana support
3 participants