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

extract cachestats to record cache stats #924

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

libotony
Copy link
Member

Description

This PR moves cachestats to a standalone file to make it available globally and applies cachestats to muxdb and chain to track cache miss/hit.

A notable change here is this PR changes the metric type in package chain to GaugeVec

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

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

  • Test A
  • Test B

Test Configuration:

  • Go Version:
  • Hardware:
  • Docker Version:

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
  • New and existing E2E tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@libotony libotony requested a review from a team as a code owner December 17, 2024 12:23
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 55.66038% with 47 lines in your changes missing coverage. Please review.

Project coverage is 60.79%. Comparing base (dcea741) to head (6f39d92).

Files with missing lines Patch % Lines
muxdb/internal/trie/cache.go 0.00% 23 Missing ⚠️
chain/repository.go 55.88% 12 Missing and 3 partials ⚠️
runtime/runtime.go 70.96% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #924      +/-   ##
==========================================
+ Coverage   60.69%   60.79%   +0.10%     
==========================================
  Files         219      220       +1     
  Lines       23383    23414      +31     
==========================================
+ Hits        14192    14235      +43     
+ Misses       8028     8010      -18     
- Partials     1163     1169       +6     

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

import "sync/atomic"

// CacheStats is a utility for collecting cache hit/miss.
type CacheStats struct {
Copy link
Member

Choose a reason for hiding this comment

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

Should we put this in metrics dir?

Copy link
Member

Choose a reason for hiding this comment

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

Captured in a ticket 👍

@otherview otherview merged commit a638cbd into vechain:master Dec 17, 2024
12 checks passed
@libotony libotony deleted the tony/cachestats branch December 18, 2024 03:41
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.

4 participants