feat(telemetry): integrate OpenTelemetry observability stack with health metrics
- Add OpenTelemetry SDK, OTLP exporter, Prometheus integration - Implement connection tracking with active/total/disconnection metrics - Add health endpoint with uptime and connection counts - Integrate tracing spans for socket events and engine messages - Add metrics collection for event handling duration - Update health endpoint to include live runtime state - Add graceful telemetry shutdown in main function - Implement engine session active metrics tracking - Add namespace-specific attributes to connection metrics - Introduce message edit history retrieval endpoint - Add scheduled message CRUD operations and dispatcher - Update Socket.IO event registration with observability - Refactor component update to remove dead code allowance - Add comprehensive environment variables documentation - Implement detailed development guidelines in AGENTS.md
This commit is contained in:
+11
-3
@@ -75,7 +75,10 @@ impl Namespace {
|
||||
}
|
||||
|
||||
/// Remove a socket by its socket SID.
|
||||
pub async fn remove_socket_by_sid(&self, socket_sid: &str) {
|
||||
///
|
||||
/// Returns `true` if a socket was actually removed, `false` if the SID
|
||||
/// was not found (already removed or never existed).
|
||||
pub async fn remove_socket_by_sid(&self, socket_sid: &str) -> bool {
|
||||
if let Some((_, socket)) = self.sockets.remove(socket_sid) {
|
||||
self.engine_to_socket.remove(&socket.engine_sid);
|
||||
self.remove_socket_from_local_rooms(socket_sid);
|
||||
@@ -86,14 +89,19 @@ impl Namespace {
|
||||
{
|
||||
tracing::warn!("Adapter del_all error for socket {}: {}", socket_sid, e);
|
||||
}
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Remove a socket by its engine SID (for engine-level disconnections).
|
||||
pub async fn remove_socket(&self, engine_sid: &str) {
|
||||
/// Returns `true` if a socket was actually removed.
|
||||
pub async fn remove_socket(&self, engine_sid: &str) -> bool {
|
||||
if let Some((_, socket_sid)) = self.engine_to_socket.remove(engine_sid) {
|
||||
self.remove_socket_by_sid(&socket_sid).await;
|
||||
return self.remove_socket_by_sid(&socket_sid).await;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
/// Look up a socket by its socket SID.
|
||||
|
||||
Reference in New Issue
Block a user