-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from pilksoc/logging
metrics for connected clients
- Loading branch information
Showing
4 changed files
with
25 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
use crate::{ws, Clients, Result}; | ||
use warp::Reply; | ||
|
||
pub async fn ws_handler(ws: warp::ws::Ws, clients: Clients) -> Result<impl Reply> | ||
{ | ||
pub async fn ws_handler(ws: warp::ws::Ws, clients: Clients) -> Result<impl Reply> { | ||
println!("ws_handler"); //debug | ||
|
||
Ok(ws.on_upgrade(move |socket| ws::client_connection(socket, clients))) | ||
} | ||
} | ||
|
||
pub async fn metrics_handler(clients: Clients) -> Result<impl Reply> { | ||
let metricsString = "cosmic_kube_clients{type=\"connected\"} ".to_string() | ||
+ &clients.lock().await.len().to_string() | ||
+ "\n"; | ||
Ok(metricsString) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters