Fix up metrics for invites distributed
This commit is contained in:
parent
9ac2df642a
commit
f7fc44cbb1
|
@ -6,7 +6,7 @@ use lox_library::{
|
|||
blockage_migration, check_blockage, issue_invite, level_up, migration, open_invite,
|
||||
redeem_invite, trust_promotion,
|
||||
},
|
||||
BridgeAuth, BridgeDb, ExceededMaxBridgesError, IssuerPubKey, MAX_DAILY_BRIDGES,
|
||||
BridgeAuth, BridgeDb, ExceededMaxBridgesError, IssuerPubKey,
|
||||
};
|
||||
use rdsys_backend::proto::{Resource, ResourceState};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -335,10 +335,6 @@ impl LoxServerContext {
|
|||
if obj.current_k == 1 {
|
||||
self.metrics.k_reset_count.inc();
|
||||
}
|
||||
// Count the number of total bridge requests
|
||||
if obj.daily_bridges_distributed <= MAX_DAILY_BRIDGES {
|
||||
self.metrics.buckets_requested_today.inc();
|
||||
}
|
||||
Ok(lox_utils::Invite { invite })
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
|
@ -402,6 +398,7 @@ impl LoxServerContext {
|
|||
|
||||
// Generate and return an open invitation token
|
||||
pub fn generate_invite(self) -> Response<Body> {
|
||||
self.metrics.invites_requested.inc();
|
||||
let invite = self.gen_invite();
|
||||
match invite {
|
||||
Ok(invite) => match serde_json::to_string(&invite) {
|
||||
|
|
|
@ -21,7 +21,7 @@ pub struct Metrics {
|
|||
pub check_blockage_count: Counter,
|
||||
pub blockage_migration_count: Counter,
|
||||
pub k_reset_count: Counter,
|
||||
pub buckets_requested_today: Counter,
|
||||
pub invites_requested: Counter,
|
||||
}
|
||||
|
||||
impl Default for Metrics {
|
||||
|
@ -40,7 +40,7 @@ impl Default for Metrics {
|
|||
let check_blockage_count = Counter::default();
|
||||
let blockage_migration_count = Counter::default();
|
||||
let k_reset_count = Counter::default();
|
||||
let buckets_requested_today = Counter::default();
|
||||
let invites_requested = Counter::default();
|
||||
|
||||
Metrics {
|
||||
existing_or_updated_bridges,
|
||||
|
@ -56,7 +56,7 @@ impl Default for Metrics {
|
|||
check_blockage_count,
|
||||
blockage_migration_count,
|
||||
k_reset_count,
|
||||
buckets_requested_today,
|
||||
invites_requested,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,9 +131,9 @@ impl Metrics {
|
|||
self.k_reset_count.clone(),
|
||||
);
|
||||
r.register(
|
||||
"buckets_requested_today",
|
||||
"number of buckets used today",
|
||||
self.buckets_requested_today.clone(),
|
||||
"invites_requested",
|
||||
"number of invites requested",
|
||||
self.invites_requested.clone(),
|
||||
);
|
||||
r
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue