heph
heph copied to clipboard
New Observer type
This Observer allows metrics to be exported, including but not limited to:
- Actor version.
- Application version.
- Target, e.g.
x86_64-apple-darwin
? - Number of processes used.
- Memory usage.
- Uptime, total time running since start.
- Number of processes (actors, initiators and tasks).
- Number of processes ready to run.
- Maybe expose a process list;
ProcessId
, name (?) and ready state.
This is going to be hard when using a seperate process per core, rather then threads.
This could be used by external crates to export to systems like Prometheus.
Also need metrics from Initiator
s, e.g. the number of requests handled and in progress.
Some more toughs.
An Observable
which can be implemented by a types that can be observed.
pub trait Observable {
// This would need to implement serde::Deserialise or something.
type Metrics;
fn observe(&self) -> Metrics;
}
For the ActorSystem
(via ActorSystemRef
) the metrics would be.
pub struct ActorSystemMetrics {
active_actors: usize,
inactive_actors: usize,
total_actors_spawned: usize,
}
For TcpListener
.
pub struct TcpListenerMetrics {
accepted_connections: usize,
}
Maybe support OpenTelemtry: https://opentelemetry.io/, https://github.com/open-telemetry/opentelemetry-specification.
See https://github.com/Thomasdezeeuw/heph/pull/484.