generated from Patagia/template-nix
parent
da210ffc16
commit
31c8921aca
13 changed files with 246 additions and 36 deletions
controller
|
@ -9,11 +9,16 @@ license = "MPL-2.0"
|
|||
anyhow.workspace = true
|
||||
clap.workspace = true
|
||||
dropshot.workspace = true
|
||||
patagia-common = { path = "../common" }
|
||||
http.workspace = true
|
||||
instrumentation = { path = "../instrumentation" }
|
||||
schemars.workspace = true
|
||||
serde.workspace = true
|
||||
slog-async.workspace = true
|
||||
slog.workspace = true
|
||||
tokio.workspace = true
|
||||
trace-request = { path = "../trace-request" }
|
||||
tracing-slog.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[package.metadata.cargo-machete]
|
||||
ignored = ["http"]
|
||||
|
|
|
@ -9,7 +9,6 @@ use std::net::SocketAddr;
|
|||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use patagia_common::instrumentation;
|
||||
use patagia_controller::api;
|
||||
use patagia_controller::context::ControllerContext;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use dropshot::{endpoint, HttpError, HttpResponseOk, RequestContext};
|
||||
use schemars::JsonSchema;
|
||||
use serde::Serialize;
|
||||
use tracing::Instrument;
|
||||
use trace_request::trace_request;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
|
@ -19,16 +19,7 @@ struct VersionInfo {
|
|||
method = GET,
|
||||
path = "/version",
|
||||
}]
|
||||
#[tracing::instrument(
|
||||
skip(rqctx),
|
||||
fields(
|
||||
http.method=rqctx.request.method().as_str(),
|
||||
http.path=rqctx.request.uri().path(),
|
||||
http.remote_ip=rqctx.request.remote_addr().ip().to_string(),
|
||||
request_id = rqctx.request_id,
|
||||
),
|
||||
err(Debug),
|
||||
)]
|
||||
#[trace_request]
|
||||
pub(crate) async fn version(
|
||||
rqctx: RequestContext<Arc<ControllerContext>>,
|
||||
) -> Result<HttpResponseOk<VersionInfo>, HttpError> {
|
||||
|
@ -45,5 +36,6 @@ pub(crate) async fn version(
|
|||
}
|
||||
.instrument(tracing::info_span!("Let's do the thing...."))
|
||||
.await;
|
||||
|
||||
Ok(HttpResponseOk(ver))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue