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

Prometheus metrics improvements #5570

Merged
merged 17 commits into from
Apr 26, 2023
Merged

Prometheus metrics improvements #5570

merged 17 commits into from
Apr 26, 2023

Conversation

deffrian
Copy link
Contributor

@deffrian deffrian commented Apr 15, 2023

Fixes Closes Resolves #
#5553

Changes

  • New Db metrics: TotalDbSize, StateDbSize, ReceiptsDbSize, HeadersDbSize, BlocksDbSize
  • SyncTime metric
  • New Version metric tags: NetworkName, MachineName(Instance), SyncType, PruningMode

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

@deffrian deffrian linked an issue Apr 15, 2023 that may be closed by this pull request
@deffrian deffrian changed the title [DRAFT] Prometheus metrics improvements Prometheus metrics improvements Apr 21, 2023
@deffrian deffrian marked this pull request as ready for review April 21, 2023 14:08
@deffrian deffrian requested a review from OlegJakushkin April 21, 2023 16:13

Db.Metrics.DbSize = _api.DbProvider!.RegisteredDbs.Values.Aggregate(0L, (sum, db) => sum + db.GetSize());
}
catch (Exception e)
Copy link
Contributor

@OlegJakushkin OlegJakushkin Apr 24, 2023

Choose a reason for hiding this comment

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

Why this is general Exception and what are the options? In other words Why can try fail?

src/Nethermind/Nethermind.Db/Metrics.cs Show resolved Hide resolved
@@ -230,6 +230,8 @@ protected internal void UpdateWriteMetrics()
Metrics.OtherDbWrites++;
}

public long GetSize() => long.Parse(_db.GetProperty("rocksdb.total-sst-files-size"));
Copy link
Contributor

Choose a reason for hiding this comment

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

How long does it take to do 1000 of such gets while DB is being modified?

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 didn't measure. But it's executed once per 5 seconds. So it shouldn't affect overall performance.

Copy link
Contributor

@OlegJakushkin OlegJakushkin Apr 24, 2023

Choose a reason for hiding this comment

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

If it would take 0.5 seconds or be heavy on disc IO it would, please measure.

@deffrian deffrian merged commit 24e6f06 into master Apr 26, 2023
@deffrian deffrian deleted the 5553-prometheus-metrics branch April 26, 2023 09:08
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.

Nethermind Prometheus metrics improvements
3 participants