pub struct Endpoints {
pub health: Endpoint,
pub live: Endpoint,
pub ready: Endpoint,
pub metrics: Endpoint,
pub version: Endpoint,
}Expand description
By default endpoints are:
const HEALTH_ENDPOINT: &str = "/health";
const LIVE_ENDPOINT: &str = "/live";
const READY_ENDPOINT: &str = "/ready";
const METRICS_ENDPOINT: &str = "/metrics";
const VERSION_ENDPOINT: &str = "/version";You might want to change those:
Example:
use fregate::{
axum::{routing::get, Router},
bootstrap, tokio, AppConfig, Application, ConfigSource,
};
async fn handler() -> &'static str {
"Hello, World!"
}
#[tokio::main]
async fn main() {
std::env::set_var("TEST_MANAGEMENT_ENDPOINTS_METRICS", "/observability");
std::env::set_var("TEST_MANAGEMENT_ENDPOINTS_HEALTH", "///also_valid");
// this is invalid default "/live" endpoint will be used.
std::env::set_var("TEST_MANAGEMENT_ENDPOINTS_LIVE", "invalid");
// this is invalid default "/ready" endpoint will be used.
std::env::set_var("TEST_MANAGEMENT_ENDPOINTS_READY", "");
let config: AppConfig = bootstrap([ConfigSource::EnvPrefix("TEST")]).unwrap();
Application::new(config)
.router(Router::new().route("/", get(handler)))
.serve()
.await
.unwrap();
}Fields§
§health: Endpointhealth endpoint
live: Endpointlive endpoint
ready: Endpointready endpoint
metrics: Endpointmetrics endpoint
version: Endpointversion endpoint
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Endpoints
impl<'de> Deserialize<'de> for Endpoints
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Endpoints
impl RefUnwindSafe for Endpoints
impl Send for Endpoints
impl Sync for Endpoints
impl Unpin for Endpoints
impl UnwindSafe for Endpoints
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request