collab: Log HTTP requests (#8297)
Co-Authored-By: Marshall <marshall@zed.dev> Release Notes: - N/A --------- Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
69c7d0e549
commit
0fbd0d6649
5 changed files with 39 additions and 10 deletions
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -1190,7 +1190,7 @@ dependencies = [
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-tungstenite",
|
"tokio-tungstenite",
|
||||||
"tower",
|
"tower",
|
||||||
"tower-http",
|
"tower-http 0.3.5",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
]
|
]
|
||||||
|
@ -1227,7 +1227,7 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tower",
|
"tower",
|
||||||
"tower-http",
|
"tower-http 0.3.5",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
]
|
]
|
||||||
|
@ -2123,6 +2123,7 @@ dependencies = [
|
||||||
"toml 0.8.10",
|
"toml 0.8.10",
|
||||||
"tonic",
|
"tonic",
|
||||||
"tower",
|
"tower",
|
||||||
|
"tower-http 0.4.4",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-log",
|
"tracing-log",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
@ -10166,6 +10167,25 @@ dependencies = [
|
||||||
"tower-service",
|
"tower-service",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tower-http"
|
||||||
|
version = "0.4.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "61c5bb1d698276a2443e5ecfabc1008bf15a36c12e6a7176e7bf089ea9131140"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.4.1",
|
||||||
|
"bytes 1.5.0",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"http 0.2.9",
|
||||||
|
"http-body",
|
||||||
|
"http-range-header",
|
||||||
|
"pin-project-lite 0.2.13",
|
||||||
|
"tower-layer",
|
||||||
|
"tower-service",
|
||||||
|
"tracing",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tower-layer"
|
name = "tower-layer"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
|
|
|
@ -235,6 +235,7 @@ thiserror = "1.0.29"
|
||||||
tiktoken-rs = "0.5.7"
|
tiktoken-rs = "0.5.7"
|
||||||
time = { version = "0.3", features = ["serde", "serde-well-known", "formatting"] }
|
time = { version = "0.3", features = ["serde", "serde-well-known", "formatting"] }
|
||||||
toml = "0.8"
|
toml = "0.8"
|
||||||
|
tower-http = "0.4.4"
|
||||||
tree-sitter = { version = "0.20", features = ["wasm"] }
|
tree-sitter = { version = "0.20", features = ["wasm"] }
|
||||||
tree-sitter-astro = { git = "https://github.com/virchau13/tree-sitter-astro.git", rev = "e924787e12e8a03194f36a113290ac11d6dc10f3" }
|
tree-sitter-astro = { git = "https://github.com/virchau13/tree-sitter-astro.git", rev = "e924787e12e8a03194f36a113290ac11d6dc10f3" }
|
||||||
tree-sitter-bash = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "7331995b19b8f8aba2d5e26deb51d2195c18bc94" }
|
tree-sitter-bash = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "7331995b19b8f8aba2d5e26deb51d2195c18bc94" }
|
||||||
|
|
2
Procfile
2
Procfile
|
@ -1,3 +1,3 @@
|
||||||
collab: RUST_LOG=${RUST_LOG:-warn,collab=info} cargo run --package=collab serve
|
collab: RUST_LOG=${RUST_LOG:-warn,tower_http=info,collab=info} cargo run --package=collab serve
|
||||||
livekit: livekit-server --dev
|
livekit: livekit-server --dev
|
||||||
blob_store: MINIO_ROOT_USER=the-blob-store-access-key MINIO_ROOT_PASSWORD=the-blob-store-secret-key minio server .blob_store
|
blob_store: MINIO_ROOT_USER=the-blob-store-access-key MINIO_ROOT_PASSWORD=the-blob-store-secret-key minio server .blob_store
|
||||||
|
|
|
@ -61,6 +61,7 @@ tokio-tungstenite = "0.17"
|
||||||
toml.workspace = true
|
toml.workspace = true
|
||||||
tonic = "0.6"
|
tonic = "0.6"
|
||||||
tower = "0.4"
|
tower = "0.4"
|
||||||
|
tower-http = { workspace = true, features = ["trace"] }
|
||||||
tracing = "0.1.34"
|
tracing = "0.1.34"
|
||||||
tracing-log = "0.1.3"
|
tracing-log = "0.1.3"
|
||||||
tracing-subscriber = { version = "0.3.11", features = ["env-filter", "json"] }
|
tracing-subscriber = { version = "0.3.11", features = ["env-filter", "json"] }
|
||||||
|
|
|
@ -12,6 +12,8 @@ use std::{
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use tokio::signal::unix::SignalKind;
|
use tokio::signal::unix::SignalKind;
|
||||||
|
use tower_http::trace::{self, TraceLayer};
|
||||||
|
use tracing::Level;
|
||||||
use tracing_log::LogTracer;
|
use tracing_log::LogTracer;
|
||||||
use tracing_subscriber::{filter::EnvFilter, fmt::format::JsonFields, Layer};
|
use tracing_subscriber::{filter::EnvFilter, fmt::format::JsonFields, Layer};
|
||||||
use util::ResultExt;
|
use util::ResultExt;
|
||||||
|
@ -72,13 +74,18 @@ async fn main() -> Result<()> {
|
||||||
if let Some(rpc_server) = rpc_server.clone() {
|
if let Some(rpc_server) = rpc_server.clone() {
|
||||||
app = app.merge(collab::rpc::routes(rpc_server))
|
app = app.merge(collab::rpc::routes(rpc_server))
|
||||||
}
|
}
|
||||||
app = app.merge(
|
app = app
|
||||||
Router::new()
|
.merge(
|
||||||
.route("/", get(handle_root))
|
Router::new()
|
||||||
.route("/healthz", get(handle_liveness_probe))
|
.route("/", get(handle_root))
|
||||||
.merge(collab::api::events::router())
|
.route("/healthz", get(handle_liveness_probe))
|
||||||
.layer(Extension(state.clone())),
|
.merge(collab::api::events::router())
|
||||||
);
|
.layer(Extension(state.clone())),
|
||||||
|
)
|
||||||
|
.layer(
|
||||||
|
TraceLayer::new_for_http()
|
||||||
|
.on_response(trace::DefaultOnResponse::new().level(Level::INFO)),
|
||||||
|
);
|
||||||
|
|
||||||
axum::Server::from_tcp(listener)?
|
axum::Server::from_tcp(listener)?
|
||||||
.serve(app.into_make_service_with_connect_info::<SocketAddr>())
|
.serve(app.into_make_service_with_connect_info::<SocketAddr>())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue