Skip to content

metrics, core: add Prometheus metrics collector, add some metrics support#497

Merged
tungng98 merged 12 commits intoBuildOnViction:pre-releasefrom
c98tristan:feat/metrics
Jan 7, 2025
Merged

metrics, core: add Prometheus metrics collector, add some metrics support#497
tungng98 merged 12 commits intoBuildOnViction:pre-releasefrom
c98tristan:feat/metrics

Conversation

@c98tristan
Copy link
Copy Markdown
Contributor

@c98tristan c98tristan commented Dec 25, 2024

This pull request introduces a series of changes aimed at enhancing the metrics collection and reporting capabilities within the tomo project. The updates include the addition of new metrics flags, the setup of a dedicated metrics server, and the tracking of various metrics related to account and storage operations.

Metrics Collection Enhancements:

  • New Metrics Flags:

    • Added new flags for enabling metrics collection and reporting, including MetricsEnabledFlag, MetricsEnabledExpensiveFlag, MetricsHTTPFlag, and MetricsPortFlag in cmd/utils/flags.go.
    • Grouped the new metrics flags under a "METRICS AND STATS" section in cmd/tomo/usage.go.
  • Metrics Server Setup:

    • Add Prometheus metrics collector, support collect metrics across the core blockchain.
    • Implemented a new SetupMetrics function in cmd/utils/flags.go to start the metrics export if enabled.
    • Modified internal/debug/flags.go to start a dedicated metrics server at the specified address, separate from the pprof server.

Metrics Tracking:

  • Account and Storage Metrics:

    • Added timers for tracking the time spent on account and storage operations in core/blockchain.go and core/state/state_object.go.
    • Updated the StateDB struct in core/state/statedb.go to include fields for tracking the duration of various operations.
  • Metrics Reporting:

    • Updated the insertChain method in core/blockchain.go to report the collected metrics.
    • Modified methods in core/state/statedb.go to measure and report the time spent on account and storage operations.

These changes collectively improve the observability and performance monitoring of the tomo project by providing detailed metrics on critical operations.

Reference:

@tungng98
Copy link
Copy Markdown
Collaborator

tungng98 commented Jan 7, 2025

LGTM

@tungng98 tungng98 merged commit 78e8ce0 into BuildOnViction:pre-release Jan 7, 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.

2 participants