Skip to content
This repository was archived by the owner on Mar 24, 2025. It is now read-only.

feat: Implement oracle_prices metric in PreBlock [BLO-790] #52

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

nivasan1
Copy link
Contributor

In This PR

  • I introduce the oracle_prices metric
  • The metric is implemented as a gauge, and reports the big.Int value reported as a float64 (in scientific notation, as opposed to an integer)
    • I also test that things don't break when using 256 bit integers

// update price metric
o.metrics.UpdatePrice(provider.Name(), string(provider.Type()), pair.String(), float64(result.Value.Int64()))
o.metrics.UpdatePrice(provider.Name(), string(provider.Type()), pair.String(), floatValue)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

context: I make this change as the .Int64() method on big.Int's behavior is undefined for non-int64 values, hence we can report incorrect information in the common-case

Copy link

codecov bot commented Jan 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2a51da8) 73.98% compared to head (e20e608) 74.01%.

❗ Current head e20e608 differs from pull request most recent head ac64596. Consider uploading reports for the commit ac64596 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
+ Coverage   73.98%   74.01%   +0.03%     
==========================================
  Files         131      125       -6     
  Lines        6776     6554     -222     
==========================================
- Hits         5013     4851     -162     
+ Misses       1434     1390      -44     
+ Partials      329      313      -16     

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

@nivasan1 nivasan1 force-pushed the nv/abci-message-size branch from 90833e6 to b7db2c2 Compare January 29, 2024 15:50
@nivasan1 nivasan1 force-pushed the nv/oracle-report-metric branch 2 times, most recently from e20e608 to 1871fed Compare January 31, 2024 00:12
@nivasan1 nivasan1 force-pushed the nv/oracle-report-metric branch from 1871fed to ac64596 Compare January 31, 2024 00:13
@nivasan1 nivasan1 changed the base branch from nv/abci-message-size to main January 31, 2024 00:13
@nivasan1 nivasan1 merged commit e5c0175 into main Jan 31, 2024
@zrbecker zrbecker deleted the nv/oracle-report-metric branch November 5, 2024 21:04
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.

2 participants