use std::fmt;
use lenso_kernel::RuntimeFailure;
pub trait WebIngressDiagnostics: fmt::Debug {
fn endpoint_runtime_failure(&self, _event: WebIngressEndpointFailure<'_>) {}
}
#[derive(Clone, Copy, Debug)]
pub struct WebIngressEndpointFailure<'a> {
request_id: &'a str,
route_id: &'a str,
provider_index: usize,
failure: &'a RuntimeFailure,
}
impl<'a> WebIngressEndpointFailure<'a> {
pub(crate) const fn new(
request_id: &'a str,
route_id: &'a str,
provider_index: usize,
failure: &'a RuntimeFailure,
) -> Self {
Self {
request_id,
route_id,
provider_index,
failure,
}
}
#[must_use]
pub const fn request_id(self) -> &'a str {
self.request_id
}
#[must_use]
pub const fn route_id(self) -> &'a str {
self.route_id
}
#[must_use]
pub const fn provider_index(self) -> usize {
self.provider_index
}
#[must_use]
pub const fn failure(self) -> &'a RuntimeFailure {
self.failure
}
}
#[derive(Debug, Default)]
pub(crate) struct NoopDiagnostics;
impl WebIngressDiagnostics for NoopDiagnostics {}