mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Switch to counter of events and add tick counter
This commit is contained in:
@ -288,7 +288,7 @@ impl Server {
|
|||||||
server_event_metrics
|
server_event_metrics
|
||||||
.event_count
|
.event_count
|
||||||
.with_label_values(&[event_name])
|
.with_label_values(&[event_name])
|
||||||
.set(i64::from(count));
|
.inc_by(count.into());
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1023,6 +1023,7 @@ impl Server {
|
|||||||
.duration_since(before_state_tick)
|
.duration_since(before_state_tick)
|
||||||
.as_secs_f64(),
|
.as_secs_f64(),
|
||||||
);
|
);
|
||||||
|
tick_metrics.tick_count.inc();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9) Finish the tick, pass control back to the frontend.
|
// 9) Finish the tick, pass control back to the frontend.
|
||||||
|
@ -62,10 +62,11 @@ pub struct TickMetrics {
|
|||||||
pub start_time: IntGauge,
|
pub start_time: IntGauge,
|
||||||
pub time_of_day: Gauge,
|
pub time_of_day: Gauge,
|
||||||
pub light_count: IntGauge,
|
pub light_count: IntGauge,
|
||||||
|
pub tick_count: IntCounter,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ServerEventMetrics {
|
pub struct ServerEventMetrics {
|
||||||
pub event_count: IntGaugeVec,
|
pub event_count: IntCounterVec,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PhysicsMetrics {
|
impl PhysicsMetrics {
|
||||||
@ -371,6 +372,10 @@ impl TickMetrics {
|
|||||||
)
|
)
|
||||||
.buckets(bucket),
|
.buckets(bucket),
|
||||||
)?;
|
)?;
|
||||||
|
let tick_count = IntCounter::with_opts(Opts::new(
|
||||||
|
"tick_count",
|
||||||
|
"counts the number of ticks that have been processed",
|
||||||
|
))?;
|
||||||
|
|
||||||
let since_the_epoch = SystemTime::now()
|
let since_the_epoch = SystemTime::now()
|
||||||
.duration_since(UNIX_EPOCH)
|
.duration_since(UNIX_EPOCH)
|
||||||
@ -387,6 +392,7 @@ impl TickMetrics {
|
|||||||
registry.register(Box::new(light_count.clone()))?;
|
registry.register(Box::new(light_count.clone()))?;
|
||||||
registry.register(Box::new(tick_time.clone()))?;
|
registry.register(Box::new(tick_time.clone()))?;
|
||||||
registry.register(Box::new(tick_time_hist.clone()))?;
|
registry.register(Box::new(tick_time_hist.clone()))?;
|
||||||
|
registry.register(Box::new(tick_count.clone()))?;
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
chonks_count,
|
chonks_count,
|
||||||
@ -399,14 +405,15 @@ impl TickMetrics {
|
|||||||
start_time,
|
start_time,
|
||||||
time_of_day,
|
time_of_day,
|
||||||
light_count,
|
light_count,
|
||||||
|
tick_count,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerEventMetrics {
|
impl ServerEventMetrics {
|
||||||
pub fn new(registry: &Registry) -> Result<Self, Box<dyn Error>> {
|
pub fn new(registry: &Registry) -> Result<Self, Box<dyn Error>> {
|
||||||
let event_count = IntGaugeVec::new(
|
let event_count = IntCounterVec::new(
|
||||||
Opts::new("event_count", "number of ServerEvents handled this tick"),
|
Opts::new("event_count", "number of ServerEvents handled"),
|
||||||
&["event"],
|
&["event"],
|
||||||
)?;
|
)?;
|
||||||
registry.register(Box::new(event_count.clone()))?;
|
registry.register(Box::new(event_count.clone()))?;
|
||||||
|
Reference in New Issue
Block a user