STASH to calculate datastore metrics
continuous-integration/drone the build failed
Details
continuous-integration/drone the build failed
Details
This commit is contained in:
parent
410a4e962b
commit
e651a953f6
|
@ -15,6 +15,7 @@ use ouroboros::self_referencing;
|
|||
use reqwest::Url;
|
||||
use std::borrow::Cow;
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::AtomicU64;
|
||||
use std::sync::Arc;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
|
@ -64,6 +65,7 @@ pub struct RakerDb {
|
|||
#[derive(Clone)]
|
||||
pub struct RakerStore {
|
||||
pub mdbx: Arc<RakerDb>,
|
||||
pub metrics: Option<Arc<RakerStoreMetrics>>,
|
||||
}
|
||||
|
||||
impl RakerStore {
|
||||
|
@ -175,6 +177,14 @@ impl RakerStore {
|
|||
}
|
||||
}
|
||||
|
||||
/// Optional struct to store metrics. Intended for exporting over Prometheus so we can see at a
|
||||
/// glance what the shape of the datastore looks like.
|
||||
pub struct RakerStoreMetrics {
|
||||
pub active_domains_count: AtomicU64,
|
||||
pub backoff_domains_count: AtomicU64,
|
||||
pub queued_url_count: AtomicU64,
|
||||
}
|
||||
|
||||
pub struct RakerTxn<'a, K: TransactionKind> {
|
||||
pub mdbx_txn: Transaction<'a, K, WriteMap>,
|
||||
mdbx: Arc<RakerDb>,
|
||||
|
@ -393,6 +403,10 @@ impl<'a> RakerTxn<'a, RW> {
|
|||
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
pub fn calculate_initial_metrics(&self) -> anyhow::Result<()> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
/// Read-only implementations (but can also be used on RW transactions)
|
||||
|
|
Loading…
Reference in New Issue