Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Improved metrics #240

Merged
merged 11 commits into from
Mar 3, 2021
Merged

Improved metrics #240

merged 11 commits into from
Mar 3, 2021

Conversation

adria0
Copy link
Contributor

@adria0 adria0 commented Jan 26, 2021

Added db metrics

To prevent a larger refactor, is decided just to keep the KeyValueDB name that comes from kvdb crate, but redefining it in the local ethcore_db

  • All uses of KeyValueDB now uses the internal crate ethcore_db instead the external crate kvdb
  • The ethcore_db::KeyValueDB is defined as pub trait KeyValueDB: kvdb::KeyValueDB + PrometheusMetrics {}
  • There are implemented two wrappers that implements the ethcore_db::KeyValueDB trait
    • DatabaseWithMetrics that wraps Database and records its metrics (disk rocksdb)
    • InMemoryWithMetrics that wraps InMemory (memory db)

Metrics recorded are:

  • kvdb_bytes_read
  • kvdb_bytes_written
  • kvdb_reads
  • kvdb_writes

note1: DB Row iterators are rarely used, so is not implemented doing an increment on kv_xxx_read counter.
note2: at this moment kvdb_reads metrics matches kvdb_writes, we already detected this when implementing metrics first time in 3.0.0 taking

Added metrics prefix

Now is possible to specify the metric prefix by using --metrics-prefix=[prefix] command line (requested by @denisgranha)

  • A new PrometheusRegistry with register_ methods is used instead of using prometheus_ functions with prometheus::Registry
  • PrometheusMetrics trait changed to use PrometheusRegistry

@adria0 adria0 changed the title Added db metrics Improved metrics Jan 27, 2021
@adria0 adria0 marked this pull request as ready for review February 1, 2021 07:36
@adria0 adria0 requested a review from rakita February 1, 2021 07:36
Copy link
Contributor

@jomuel jomuel left a comment

Choose a reason for hiding this comment

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

The build failure seems to be unrelated?

crates/db/db/src/db.rs Outdated Show resolved Hide resolved
Co-authored-by: Jochen Müller <mail@jnmr.de>
@rakita rakita marked this pull request as draft February 17, 2021 16:32
@rakita rakita marked this pull request as ready for review March 1, 2021 09:19
@rakita rakita requested a review from jomuel March 1, 2021 09:19
Copy link
Contributor

@rakita rakita left a comment

Choose a reason for hiding this comment

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

lgtm

@adria0 adria0 merged commit 0fcb102 into dev Mar 3, 2021
@adria0 adria0 deleted the adria0/dbmetrics branch March 3, 2021 21:44
rakita added a commit to rakita/openethereum that referenced this pull request Mar 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants