Re-add candles total metric
This commit is contained in:
parent
a5570b816e
commit
3ad2335300
|
@ -16,6 +16,8 @@ use crate::{
|
||||||
|
|
||||||
use self::higher_order_candles::batch_higher_order_candles;
|
use self::higher_order_candles::batch_higher_order_candles;
|
||||||
|
|
||||||
|
use super::metrics::METRIC_CANDLES_TOTAL;
|
||||||
|
|
||||||
pub async fn batch_for_market(pool: &Pool, market: &MarketInfo) -> anyhow::Result<()> {
|
pub async fn batch_for_market(pool: &Pool, market: &MarketInfo) -> anyhow::Result<()> {
|
||||||
loop {
|
loop {
|
||||||
let market_clone = market.clone();
|
let market_clone = market.clone();
|
||||||
|
@ -41,12 +43,18 @@ pub async fn batch_for_market(pool: &Pool, market: &MarketInfo) -> anyhow::Resul
|
||||||
async fn batch_inner(pool: &Pool, market: &MarketInfo) -> anyhow::Result<()> {
|
async fn batch_inner(pool: &Pool, market: &MarketInfo) -> anyhow::Result<()> {
|
||||||
let market_name = &market.name.clone();
|
let market_name = &market.name.clone();
|
||||||
let candles = batch_1m_candles(pool, market).await?;
|
let candles = batch_1m_candles(pool, market).await?;
|
||||||
|
METRIC_CANDLES_TOTAL
|
||||||
|
.with_label_values(&[market.name.as_str()])
|
||||||
|
.inc_by(candles.clone().len() as u64);
|
||||||
save_candles(pool, candles).await?;
|
save_candles(pool, candles).await?;
|
||||||
for resolution in Resolution::iter() {
|
for resolution in Resolution::iter() {
|
||||||
if resolution == Resolution::R1m {
|
if resolution == Resolution::R1m {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let candles = batch_higher_order_candles(pool, market_name, resolution).await?;
|
let candles = batch_higher_order_candles(pool, market_name, resolution).await?;
|
||||||
|
METRIC_CANDLES_TOTAL
|
||||||
|
.with_label_values(&[market.name.as_str()])
|
||||||
|
.inc_by(candles.clone().len() as u64);
|
||||||
save_candles(pool, candles).await?;
|
save_candles(pool, candles).await?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -6,7 +6,7 @@ use solana_client::{
|
||||||
};
|
};
|
||||||
use solana_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey, signature::Signature};
|
use solana_sdk::{commitment_config::CommitmentConfig, pubkey::Pubkey, signature::Signature};
|
||||||
use solana_transaction_status::UiTransactionEncoding;
|
use solana_transaction_status::UiTransactionEncoding;
|
||||||
use std::{collections::HashMap, str::FromStr, time::Duration as WaitDuration};
|
use std::{collections::HashMap, str::FromStr};
|
||||||
use tokio::sync::mpsc::Sender;
|
use tokio::sync::mpsc::Sender;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
Loading…
Reference in New Issue