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

[blockchain] Add database file size metric #4185

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

envestcc
Copy link
Member

Description

Fixes #4160

Type of change

Please delete options that are not relevant.

  • Code refactor or improvement

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • make test

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] I have made corresponding changes to the documentation
  • [] My changes generate no new warnings
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] New and existing unit tests pass locally with my changes
  • [] Any dependent changes have been merged and published in downstream modules

blockchain/blockchain.go Outdated Show resolved Hide resolved
blockchain/blockchain.go Outdated Show resolved Hide resolved
blockchain/blockchain.go Outdated Show resolved Hide resolved
@@ -45,6 +49,14 @@ var (
},
[]string{"type"},
)
fileSizeMtc = prometheus.NewGaugeVec(
Copy link
Member

Choose a reason for hiding this comment

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

Three ways to monitor the file size:

  1. Export the metrics directly from the cloud service.
  2. Run a daemon service or process to report the metrics.
  3. Monitor the metrics in db_bolt.go.

The last one is the least preferred if the first two can't work.

Copy link
Member Author

Choose a reason for hiding this comment

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

for 1, it should only be able to monitor at the mount level and cannot monitor specific files.
for 2, it may be a heavy changes for this small requirement.
I think 3 is a good approach that can also address the monitoring of chain-000000xx.db files mentioned above.

Copy link
Member

Choose a reason for hiding this comment

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

for 2, there have been existing tools to use, like https://github.com/prometheus/node_exporter

Copy link

sonarcloud bot commented Mar 27, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
5.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@envestcc envestcc requested a review from Liuhaai March 27, 2024 12:26
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 76.75%. Comparing base (e1f0636) to head (4eb0144).
Report is 215 commits behind head on master.

Files Patch % Lines
db/db_bolt.go 40.00% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4185      +/-   ##
==========================================
+ Coverage   75.38%   76.75%   +1.37%     
==========================================
  Files         303      340      +37     
  Lines       25923    29268    +3345     
==========================================
+ Hits        19541    22465    +2924     
- Misses       5360     5697     +337     
- Partials     1022     1106      +84     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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.

Add metrics for db size
4 participants