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

Needed changes for metrics improvements #887

Merged
merged 3 commits into from
Feb 13, 2023
Merged

Conversation

AlfredoG87
Copy link
Collaborator

@AlfredoG87 AlfredoG87 commented Feb 8, 2023

Description:

This PR defines bucket ranges for the histogram of the following metrics:

-rpc_relay_mirror_response
-rpc_relay_method_response
from using the default bucket values of [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10] that are measuring latency in seconds to [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000] that are measuring latency in milliseconds, witch is the unit of the observations taken.

And also removed line that decreases the gauge (operatorAccountGauge), that its purpose is to have visibility to the costs per account, but that is also being tracker by rpc_relay_consensusnode_response. So better remove to decrease complexity, unneeded redundancy.

Related issue(s):
#866

Fixes #866

Notes for reviewer:

Current Metrics with old buckets:
image

After this PR:
image

Current Gauge Metrics:
image

After this PR:
image

After this PR:
Newly created metric for hbarLimiter is working as expected
image

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@AlfredoG87 AlfredoG87 marked this pull request as draft February 8, 2023 17:20
…sts in milliseconds, default values were [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10] that makes sense if observations where made in seconds, but we are doing observations in ms and changed them to [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000].

Removed the decrement of gauge since we already have a collect method that is collecting the current balance, for calculating costs we should use consensusNodeClientHistorgram

Signed-off-by: Alfredo Gutierrez <[email protected]>
… Metric and added Counter to keep track of HbarLimiter metrics

Signed-off-by: Alfredo Gutierrez <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2023

Codecov Report

Base: 74.16% // Head: 74.33% // Increases project coverage by +0.16% 🎉

Coverage data is based on head (b7884b2) compared to base (1f9b860).
Patch coverage: 75.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #887      +/-   ##
==========================================
+ Coverage   74.16%   74.33%   +0.16%     
==========================================
  Files          29       29              
  Lines        1827     1835       +8     
  Branches      339      341       +2     
==========================================
+ Hits         1355     1364       +9     
+ Misses        374      373       -1     
  Partials       98       98              
Impacted Files Coverage Δ
packages/relay/src/lib/clients/mirrorNodeClient.ts 94.32% <ø> (ø)
packages/server/src/server.ts 76.88% <ø> (ø)
packages/relay/src/lib/clients/sdkClient.ts 21.13% <40.00%> (+0.51%) ⬆️
packages/server/src/rateLimit/index.ts 57.89% <80.00%> (ø)
packages/relay/src/lib/hbarlimiter/index.ts 100.00% <100.00%> (ø)
packages/relay/src/lib/eth.ts 82.90% <0.00%> (+0.05%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@AlfredoG87 AlfredoG87 marked this pull request as ready for review February 10, 2023 15:48
@david-bakin-sl
Copy link
Member

Good catch on bucketing by seconds vs milliseconds!

david-bakin-sl
david-bakin-sl previously approved these changes Feb 10, 2023
Copy link
Member

@david-bakin-sl david-bakin-sl left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG, mostly recommended nits

packages/relay/src/lib/clients/mirrorNodeClient.ts Outdated Show resolved Hide resolved
packages/relay/tests/lib/hbarLimiter.spec.ts Outdated Show resolved Hide resolved
packages/server/src/server.ts Outdated Show resolved Hide resolved
@Nana-EC Nana-EC added enhancement New feature or request P2 process Build, test and deployment-process related tasks labels Feb 11, 2023
@Nana-EC Nana-EC added this to the 0.18.0 milestone Feb 11, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

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

LG

@AlfredoG87 AlfredoG87 merged commit 419ea9f into main Feb 13, 2023
@AlfredoG87 AlfredoG87 deleted the 866-improve-metrics branch February 13, 2023 14:59
Nana-EC pushed a commit that referenced this pull request Feb 15, 2023
* Added buckets with more meaningful values in the context of api requests in milliseconds, default values were [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10] that makes sense if observations where made in seconds, but we are doing observations in ms and changed them to [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000].
Removed the decrement of gauge since we already have a collect method that is collecting the current balance, for calculating costs we should use consensusNodeClientHistorgram

* Metric improvements changed Gauge for Counter used on IP Rate Limiter Metric and added Counter to keep track of HbarLimiter metrics

---------

Signed-off-by: Alfredo Gutierrez <[email protected]>
Nana-EC pushed a commit that referenced this pull request Feb 15, 2023
* Added buckets with more meaningful values in the context of api requests in milliseconds, default values were [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10] that makes sense if observations where made in seconds, but we are doing observations in ms and changed them to [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000].
Removed the decrement of gauge since we already have a collect method that is collecting the current balance, for calculating costs we should use consensusNodeClientHistorgram

* Metric improvements changed Gauge for Counter used on IP Rate Limiter Metric and added Counter to keep track of HbarLimiter metrics

---------

Signed-off-by: Alfredo Gutierrez <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Nana-EC added a commit that referenced this pull request Feb 15, 2023
Cherry pick PRs that went into main branch since cutting a 0.18.0-alpha1. PRs map to individual commits
- [PR 882 - eth_feeHistory invalid cached response](#882)
- [PR 887 - Needed changes for metrics improvements](#887)
- [PR 883 - Handle GRPC timeout error](#883)
- PR 898 - update-logs-and-metrics Added the requestId to the server context](#898)

---------

Signed-off-by: ebadiere <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>

---------

Signed-off-by: nikolay <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
Signed-off-by: Alfredo Gutierrez <[email protected]>
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: ebadiere <[email protected]>
Co-authored-by: Nikolay Atanasow <[email protected]>
Co-authored-by: Alfredo Gutierrez <[email protected]>
Co-authored-by: Ivo Yankov <[email protected]>
Co-authored-by: Eric Badiere <[email protected]>
Nana-EC pushed a commit that referenced this pull request Feb 15, 2023
* Added buckets with more meaningful values in the context of api requests in milliseconds, default values were [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10] that makes sense if observations where made in seconds, but we are doing observations in ms and changed them to [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000].
Removed the decrement of gauge since we already have a collect method that is collecting the current balance, for calculating costs we should use consensusNodeClientHistorgram

* Metric improvements changed Gauge for Counter used on IP Rate Limiter Metric and added Counter to keep track of HbarLimiter metrics

---------

Signed-off-by: Alfredo Gutierrez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 process Build, test and deployment-process related tasks
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Review application metrics story
4 participants