metrics, core: add Prometheus metrics collector, add some metrics support #497
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
MetricsEnabledFlag
,MetricsEnabledExpensiveFlag
,MetricsHTTPFlag
, andMetricsPortFlag
incmd/utils/flags.go
.cmd/tomo/usage.go
.Metrics Server Setup:
SetupMetrics
function incmd/utils/flags.go
to start the metrics export if enabled.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:
core/blockchain.go
andcore/state/state_object.go
.StateDB
struct incore/state/statedb.go
to include fields for tracking the duration of various operations.Metrics Reporting:
insertChain
method incore/blockchain.go
to report the collected metrics.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: