-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update price service to use helium-lib (#832)
* Update price to use helium-lib to retrieve on chain price * remove unused dep * remove commented out code * Add async featur to anchor-client * remove commented code
- Loading branch information
Showing
10 changed files
with
1,626 additions
and
933 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
use helium_proto::BlockchainTokenTypeV1; | ||
use helium_lib::token::Token; | ||
|
||
const PRICE_GAUGE: &str = concat!(env!("CARGO_PKG_NAME"), "_", "price_gauge"); | ||
|
||
pub struct Metrics; | ||
|
||
impl Metrics { | ||
pub fn update(counter: String, token_type: BlockchainTokenTypeV1, price: f64) { | ||
increment_counter(counter, token_type); | ||
set_gauge(token_type, price) | ||
pub fn update(counter: String, token: Token, price: f64) { | ||
increment_counter(counter, token); | ||
set_gauge(token, price) | ||
} | ||
} | ||
|
||
fn increment_counter(counter: String, token_type: BlockchainTokenTypeV1) { | ||
metrics::counter!(counter, "token_type" => token_type.as_str_name()).increment(1); | ||
fn increment_counter(counter: String, token: Token) { | ||
metrics::counter!(counter, "token_type" => token.to_string()).increment(1); | ||
} | ||
|
||
fn set_gauge(token_type: BlockchainTokenTypeV1, value: f64) { | ||
metrics::gauge!(PRICE_GAUGE, "token_type" => token_type.as_str_name()).set(value); | ||
fn set_gauge(token: Token, value: f64) { | ||
metrics::gauge!(PRICE_GAUGE, "token_type" => token.to_string()).set(value); | ||
} |
Oops, something went wrong.