mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
update version, revert from static prometheus back to normal because static doesnt supprot registries, and implement most of the metrics except for entity count
This commit is contained in:
parent
8d3fb40419
commit
b05e51152f
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -2461,7 +2461,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prometheus-static-metric"
|
name = "prometheus-static-metric"
|
||||||
version = "0.1.4"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -3091,7 +3091,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "specs-idvs"
|
name = "specs-idvs"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://gitlab.com/veloren/specs-idvs.git#18ad795469f45d58fdcfcb4ee48435b2061bc7bc"
|
source = "git+https://gitlab.com/veloren/specs-idvs.git#4ce792042f951a29874954582234836c0eccaed6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -3584,7 +3584,7 @@ dependencies = [
|
|||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"prometheus-static-metric 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"prometheus-static-metric 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ron 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"scan_fmt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"scan_fmt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -4151,7 +4151,7 @@ dependencies = [
|
|||||||
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
|
||||||
"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802"
|
"checksum proc-macro2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4c5c2380ae88876faae57698be9e9775e3544decad214599c3a6266cca6ac802"
|
||||||
"checksum prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5567486d5778e2c6455b1b90ff1c558f29e751fc018130fa182e15828e728af1"
|
"checksum prometheus 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5567486d5778e2c6455b1b90ff1c558f29e751fc018130fa182e15828e728af1"
|
||||||
"checksum prometheus-static-metric 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1d2b4a6a1ae793e7eb6773a5301a5a08e8929ea5517b677c93e57ce2d0973c02"
|
"checksum prometheus-static-metric 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1baa57413523cff73783204f73299a3f602ebcf51a5e64752b32bc1b3c376013"
|
||||||
"checksum protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40361836defdd5871ff7e84096c6f6444af7fc157f8ef1789f54f147687caa20"
|
"checksum protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40361836defdd5871ff7e84096c6f6444af7fc157f8ef1789f54f147687caa20"
|
||||||
"checksum quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18c45c4854d6d1cf5d531db97c75880feb91c958b0720f4ec1057135fec358b3"
|
"checksum quasi 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18c45c4854d6d1cf5d531db97c75880feb91c958b0720f4ec1057135fec358b3"
|
||||||
"checksum quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9e25fa23c044c1803f43ca59c98dac608976dd04ce799411edd58ece776d4"
|
"checksum quasi_codegen 0.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "51b9e25fa23c044c1803f43ca59c98dac608976dd04ce799411edd58ece776d4"
|
||||||
|
@ -267,6 +267,40 @@ impl<'a, V: Vox, S: RectVolSize, M: Clone> IntoPosIterator for &'a Chonk<V, S, M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
pub struct ChonkMetrics {
|
||||||
|
chonks: usize,
|
||||||
|
homogeneous: usize,
|
||||||
|
hash: usize,
|
||||||
|
heterogeneous: usize,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ChonkMetrics {
|
||||||
|
pub fn chonks(&self) -> usize {
|
||||||
|
self.chonks
|
||||||
|
}
|
||||||
|
pub fn homogeneous(&self) -> usize {
|
||||||
|
self.homogeneous
|
||||||
|
}
|
||||||
|
pub fn hash(&self) -> usize {
|
||||||
|
self.hash
|
||||||
|
}
|
||||||
|
pub fn heterogeneous(&self) -> usize {
|
||||||
|
self.heterogeneous
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for ChonkMetrics {
|
||||||
|
fn default() -> Self {
|
||||||
|
ChonkMetrics {
|
||||||
|
chonks: 0,
|
||||||
|
homogeneous: 0,
|
||||||
|
hash: 0,
|
||||||
|
heterogeneous: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, V: Vox, S: RectVolSize, M: Clone> IntoVolIterator<'a> for &'a Chonk<V, S, M> {
|
impl<'a, V: Vox, S: RectVolSize, M: Clone> IntoVolIterator<'a> for &'a Chonk<V, S, M> {
|
||||||
type IntoIter = ChonkVolIter<'a, V, S, M>;
|
type IntoIter = ChonkVolIter<'a, V, S, M>;
|
||||||
|
|
||||||
|
@ -22,5 +22,5 @@ chrono = "0.4.7"
|
|||||||
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
||||||
crossbeam = "0.7.2"
|
crossbeam = "0.7.2"
|
||||||
prometheus = "0.7"
|
prometheus = "0.7"
|
||||||
prometheus-static-metric = "0.1"
|
prometheus-static-metric = "0.2"
|
||||||
hyper = "0.12.34"
|
hyper = "0.12.34"
|
@ -6,8 +6,8 @@ pub mod client;
|
|||||||
pub mod cmd;
|
pub mod cmd;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod input;
|
pub mod input;
|
||||||
pub mod settings;
|
|
||||||
pub mod metrics;
|
pub mod metrics;
|
||||||
|
pub mod settings;
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
pub use crate::{error::Error, input::Input, settings::ServerSettings};
|
pub use crate::{error::Error, input::Input, settings::ServerSettings};
|
||||||
@ -23,19 +23,24 @@ use common::{
|
|||||||
msg::{ClientMsg, ClientState, RequestStateError, ServerError, ServerInfo, ServerMsg},
|
msg::{ClientMsg, ClientState, RequestStateError, ServerError, ServerInfo, ServerMsg},
|
||||||
net::PostOffice,
|
net::PostOffice,
|
||||||
state::{BlockChange, State, TimeOfDay, Uid},
|
state::{BlockChange, State, TimeOfDay, Uid},
|
||||||
terrain::{block::Block, TerrainChunk, TerrainChunkSize, TerrainGrid},
|
terrain::{block::Block, chonk::ChonkMetrics, TerrainChunk, TerrainChunkSize, TerrainGrid},
|
||||||
vol::{ReadVol, RectVolSize, Vox},
|
vol::{ReadVol, RectVolSize, Vox},
|
||||||
};
|
};
|
||||||
use crossbeam::channel;
|
use crossbeam::channel;
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
|
use metrics::ServerMetrics;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity, SystemData};
|
use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity};
|
||||||
use std::{i32, net::SocketAddr, sync::Arc, time::{Duration, Instant}};
|
use std::{
|
||||||
|
i32,
|
||||||
|
net::SocketAddr,
|
||||||
|
sync::Arc,
|
||||||
|
time::{Duration, Instant},
|
||||||
|
};
|
||||||
use uvth::{ThreadPool, ThreadPoolBuilder};
|
use uvth::{ThreadPool, ThreadPoolBuilder};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use world::{ChunkSupplement, World};
|
use world::{ChunkSupplement, World};
|
||||||
use metrics::ServerMetrics;
|
|
||||||
|
|
||||||
const CLIENT_TIMEOUT: f64 = 20.0; // Seconds
|
const CLIENT_TIMEOUT: f64 = 20.0; // Seconds
|
||||||
|
|
||||||
@ -383,7 +388,7 @@ impl Server {
|
|||||||
// 7) Update Metrics with current data
|
// 7) Update Metrics with current data
|
||||||
// 8) Finish the tick, passing control of the main thread back to the frontend
|
// 8) Finish the tick, passing control of the main thread back to the frontend
|
||||||
|
|
||||||
let before_tick = Instant::now();
|
let before_tick_1 = Instant::now();
|
||||||
// 1) Build up a list of events for this frame, to be passed to the frontend.
|
// 1) Build up a list of events for this frame, to be passed to the frontend.
|
||||||
let mut frontend_events = Vec::new();
|
let mut frontend_events = Vec::new();
|
||||||
|
|
||||||
@ -401,12 +406,14 @@ impl Server {
|
|||||||
// Handle game events
|
// Handle game events
|
||||||
self.handle_events();
|
self.handle_events();
|
||||||
|
|
||||||
|
let before_tick_4 = Instant::now();
|
||||||
// 4) Tick the client's LocalState.
|
// 4) Tick the client's LocalState.
|
||||||
self.state.tick(dt);
|
self.state.tick(dt);
|
||||||
|
|
||||||
// Tick the world
|
// Tick the world
|
||||||
self.world.tick(dt);
|
self.world.tick(dt);
|
||||||
|
|
||||||
|
let before_tick_5 = Instant::now();
|
||||||
// 5) Fetch any generated `TerrainChunk`s and insert them into the terrain.
|
// 5) Fetch any generated `TerrainChunk`s and insert them into the terrain.
|
||||||
// Also, send the chunk data to anybody that is close by.
|
// Also, send the chunk data to anybody that is close by.
|
||||||
if let Ok((key, (chunk, supplement))) = self.chunk_rx.try_recv() {
|
if let Ok((key, (chunk, supplement))) = self.chunk_rx.try_recv() {
|
||||||
@ -526,6 +533,7 @@ impl Server {
|
|||||||
self.state.remove_chunk(key);
|
self.state.remove_chunk(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let before_tick_6 = Instant::now();
|
||||||
// 6) Synchronise clients with the new state of the world.
|
// 6) Synchronise clients with the new state of the world.
|
||||||
self.sync_clients();
|
self.sync_clients();
|
||||||
|
|
||||||
@ -590,9 +598,47 @@ impl Server {
|
|||||||
let _ = self.state.ecs_mut().delete_entity(entity);
|
let _ = self.state.ecs_mut().delete_entity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let before_tick_7 = Instant::now();
|
||||||
// 7) Update Metrics
|
// 7) Update Metrics
|
||||||
self.metrics.player_online.set(self.clients.len() as f64);
|
self.metrics
|
||||||
self.metrics.tick_time.set(before_tick.elapsed().as_nanos() as f64);
|
.tick_time
|
||||||
|
.with_label_values(&["input"])
|
||||||
|
.set((before_tick_4 - before_tick_1).as_nanos() as i64);
|
||||||
|
self.metrics
|
||||||
|
.tick_time
|
||||||
|
.with_label_values(&["world"])
|
||||||
|
.set((before_tick_5 - before_tick_4).as_nanos() as i64);
|
||||||
|
self.metrics
|
||||||
|
.tick_time
|
||||||
|
.with_label_values(&["terrain"])
|
||||||
|
.set((before_tick_6 - before_tick_5).as_nanos() as i64);
|
||||||
|
self.metrics
|
||||||
|
.tick_time
|
||||||
|
.with_label_values(&["sync"])
|
||||||
|
.set((before_tick_7 - before_tick_6).as_nanos() as i64);
|
||||||
|
self.metrics.player_online.set(self.clients.len() as i64);
|
||||||
|
let cm = self
|
||||||
|
.state
|
||||||
|
.terrain()
|
||||||
|
.iter()
|
||||||
|
.fold(ChonkMetrics::default(), |a, (_, c)| a + c.get_metrics());
|
||||||
|
self.metrics
|
||||||
|
.chonks_count
|
||||||
|
.with_label_values(&["homogeneous"])
|
||||||
|
.set(cm.homogeneous() as i64);
|
||||||
|
self.metrics
|
||||||
|
.chonks_count
|
||||||
|
.with_label_values(&["hash"])
|
||||||
|
.set(cm.hash() as i64);
|
||||||
|
self.metrics
|
||||||
|
.chonks_count
|
||||||
|
.with_label_values(&["heterogeneous"])
|
||||||
|
.set(cm.heterogeneous() as i64);
|
||||||
|
//self.metrics.entity_count.set(self.state.);
|
||||||
|
self.metrics
|
||||||
|
.tick_time
|
||||||
|
.with_label_values(&["metrics"])
|
||||||
|
.set(before_tick_7.elapsed().as_nanos() as i64);
|
||||||
|
|
||||||
// 8) Finish the tick, pass control back to the frontend.
|
// 8) Finish the tick, pass control back to the frontend.
|
||||||
|
|
||||||
|
@ -1,31 +1,22 @@
|
|||||||
extern crate prometheus;
|
|
||||||
extern crate hyper;
|
extern crate hyper;
|
||||||
|
extern crate prometheus;
|
||||||
extern crate prometheus_static_metric;
|
extern crate prometheus_static_metric;
|
||||||
use hyper::rt::Future;
|
use hyper::rt::Future;
|
||||||
use hyper::service::service_fn_ok;
|
use hyper::service::service_fn_ok;
|
||||||
use hyper::{Body, Request, Response, Server};
|
use hyper::{Body, Request, Response, Server};
|
||||||
use prometheus::{TextEncoder, Encoder, Registry, Counter, Gauge, Opts, GaugeVec, CounterVec};
|
use prometheus::{Encoder, IntGauge, IntGaugeVec, Opts, Registry, TextEncoder};
|
||||||
use prometheus_static_metric::make_static_metric;
|
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::thread::JoinHandle;
|
||||||
|
|
||||||
make_static_metric! {
|
|
||||||
pub struct StaticChonkGaugeVec: Gauge {
|
|
||||||
"method" => {
|
|
||||||
hetero,
|
|
||||||
hash,
|
|
||||||
homo,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub struct ServerMetrics {
|
pub struct ServerMetrics {
|
||||||
pub chonks_count: StaticChonkGaugeVec,
|
pub chonks_count: IntGaugeVec,
|
||||||
pub player_online: Gauge,
|
pub player_online: IntGauge,
|
||||||
pub entity_count: Gauge,
|
pub entity_count: IntGauge,
|
||||||
pub tick_time: Gauge,
|
pub tick_time: IntGaugeVec,
|
||||||
pub build_info: Gauge,
|
pub build_info: IntGauge,
|
||||||
pub light_count: Gauge,
|
pub light_count: IntGauge,
|
||||||
pub registry: Registry,
|
pub registry: Registry,
|
||||||
|
pub handle: Option<JoinHandle<()>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn metric_service(_req: Request<Body>) -> Response<Body> {
|
fn metric_service(_req: Request<Body>) -> Response<Body> {
|
||||||
@ -40,6 +31,7 @@ fn metric_service(_req: Request<Body>) -> Response<Body> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ServerMetrics {
|
impl ServerMetrics {
|
||||||
|
/*
|
||||||
fn metric_service(&self, _req: Request<Body>) -> Response<Body> {
|
fn metric_service(&self, _req: Request<Body>) -> Response<Body> {
|
||||||
let encoder = TextEncoder::new();
|
let encoder = TextEncoder::new();
|
||||||
let mut buffer = vec![];
|
let mut buffer = vec![];
|
||||||
@ -49,40 +41,58 @@ impl ServerMetrics {
|
|||||||
.header(hyper::header::CONTENT_TYPE, encoder.format_type())
|
.header(hyper::header::CONTENT_TYPE, encoder.format_type())
|
||||||
.body(Body::from(buffer))
|
.body(Body::from(buffer))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
}
|
}*/
|
||||||
|
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let opts = Opts::new("player_online", "shows the number of clients connected to the server");
|
let opts = Opts::new(
|
||||||
let player_online = Gauge::with_opts(opts).unwrap();
|
"player_online",
|
||||||
let opts = Opts::new("entity_count", "number of all entities currently active on the server");
|
"shows the number of clients connected to the server",
|
||||||
let entity_count = Gauge::with_opts(opts).unwrap();
|
);
|
||||||
let opts = Opts::new("tick_time", "time in ms requiered for a tick of the server");
|
let player_online = IntGauge::with_opts(opts).unwrap();
|
||||||
let tick_time = Gauge::with_opts(opts).unwrap();
|
let opts = Opts::new(
|
||||||
|
"entity_count",
|
||||||
|
"number of all entities currently active on the server",
|
||||||
|
);
|
||||||
|
let entity_count = IntGauge::with_opts(opts).unwrap();
|
||||||
let opts = Opts::new("veloren_build_info", "Build information")
|
let opts = Opts::new("veloren_build_info", "Build information")
|
||||||
.const_label("hash", common::util::GIT_HASH)
|
.const_label("hash", common::util::GIT_HASH)
|
||||||
.const_label("version", "");
|
.const_label("version", "");
|
||||||
let build_info = Gauge::with_opts(opts).unwrap();
|
let build_info = IntGauge::with_opts(opts).unwrap();
|
||||||
let opts = Opts::new("light_count", "number of all lights currently active on the server");
|
let opts = Opts::new(
|
||||||
let light_count = Gauge::with_opts(opts).unwrap();
|
"light_count",
|
||||||
let vec = GaugeVec::new(Opts::new("chonks_count", "number of all chonks currently active on the server"), &["method"]).unwrap();
|
"number of all lights currently active on the server",
|
||||||
let chonks_count = StaticChonkGaugeVec::from(&vec);
|
);
|
||||||
|
let light_count = IntGauge::with_opts(opts).unwrap();
|
||||||
chonks_count.hetero.set(1337.0);
|
let vec = IntGaugeVec::new(
|
||||||
chonks_count.hash.set(42.0);
|
Opts::new(
|
||||||
entity_count.set(42.0);
|
"chonks_count",
|
||||||
|
"number of all chonks currently active on the server",
|
||||||
|
),
|
||||||
|
&["type"],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let chonks_count: IntGaugeVec = IntGaugeVec::from(vec);
|
||||||
|
let vec = IntGaugeVec::new(
|
||||||
|
Opts::new("tick_time", "time in ns requiered for a tick of the server"),
|
||||||
|
&["period"],
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let tick_time = IntGaugeVec::from(vec);
|
||||||
|
|
||||||
let registry = Registry::new();
|
let registry = Registry::new();
|
||||||
//registry.register(Box::new(chonks_count.clone())).unwrap();
|
//registry.register(Box::new(chonks_count.clone())).unwrap();
|
||||||
registry.register(Box::new(player_online.clone())).unwrap();
|
registry.register(Box::new(player_online.clone())).unwrap();
|
||||||
registry.register(Box::new(entity_count.clone())).unwrap();
|
registry.register(Box::new(entity_count.clone())).unwrap();
|
||||||
registry.register(Box::new(tick_time.clone())).unwrap();
|
|
||||||
registry.register(Box::new(build_info.clone())).unwrap();
|
registry.register(Box::new(build_info.clone())).unwrap();
|
||||||
registry.register(Box::new(light_count.clone())).unwrap();
|
//registry.register(Box::new(light_count.clone())).unwrap();
|
||||||
|
registry.register(Box::new(chonks_count.clone())).unwrap();
|
||||||
|
registry.register(Box::new(tick_time.clone())).unwrap();
|
||||||
prometheus::register(Box::new(player_online.clone())).unwrap();
|
prometheus::register(Box::new(player_online.clone())).unwrap();
|
||||||
prometheus::register(Box::new(entity_count.clone())).unwrap();
|
prometheus::register(Box::new(entity_count.clone())).unwrap();
|
||||||
prometheus::register(Box::new(tick_time.clone())).unwrap();
|
|
||||||
prometheus::register(Box::new(build_info.clone())).unwrap();
|
prometheus::register(Box::new(build_info.clone())).unwrap();
|
||||||
prometheus::register(Box::new(light_count.clone())).unwrap();
|
//prometheus::register(Box::new(light_count.clone())).unwrap();
|
||||||
|
prometheus::register(Box::new(chonks_count.clone())).unwrap();
|
||||||
|
prometheus::register(Box::new(tick_time.clone())).unwrap();
|
||||||
|
|
||||||
let mut metrics = Self {
|
let mut metrics = Self {
|
||||||
chonks_count,
|
chonks_count,
|
||||||
@ -92,6 +102,7 @@ impl ServerMetrics {
|
|||||||
build_info,
|
build_info,
|
||||||
light_count,
|
light_count,
|
||||||
registry,
|
registry,
|
||||||
|
handle: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let addr = ([0, 0, 0, 0], 14005).into();
|
let addr = ([0, 0, 0, 0], 14005).into();
|
||||||
@ -103,6 +114,7 @@ impl ServerMetrics {
|
|||||||
let handle = thread::spawn(|| {
|
let handle = thread::spawn(|| {
|
||||||
hyper::rt::run(server);
|
hyper::rt::run(server);
|
||||||
});
|
});
|
||||||
|
metrics.handle = Some(handle);
|
||||||
|
|
||||||
metrics
|
metrics
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user