pub struct Incidents { /* private fields */ }Expand description
Deduplicated runtime incident store backed by the slabs_incidents system table.
Implementations§
Source§impl Incidents
impl Incidents
Sourcepub async fn record_with_outcome(
&self,
input: IncidentInput,
) -> Result<(IncidentRecord, IncidentOutcome), SlabError>
pub async fn record_with_outcome( &self, input: IncidentInput, ) -> Result<(IncidentRecord, IncidentOutcome), SlabError>
Atomically records or deduplicates an incident and returns its exact IncidentOutcome.
Uses input.custom_fingerprint when provided (hashed under a domain prefix so fingerprints
remain fixed-width SHA-256 hex). Otherwise derives the fingerprint deterministically from
(kind, source_file, route_pattern, error_message), appending a unique nonce when
kind == "user_bug_report" so individual user bug reports remain distinct.
Truncates error_message to 1024 bytes and detail to 4096 bytes on UTF-8 character
boundaries, and upserts inside a BEGIN IMMEDIATE transaction.
Sourcepub async fn record(
&self,
input: IncidentInput,
) -> Result<(IncidentRecord, bool), SlabError>
pub async fn record( &self, input: IncidentInput, ) -> Result<(IncidentRecord, bool), SlabError>
Atomically records or deduplicates an incident by deterministic fingerprint.
Delegates to Incidents::record_with_outcome, returning (record, is_new_or_reopened),
where the boolean is true for IncidentOutcome::Opened or IncidentOutcome::Reopened.
Sourcepub async fn list(
&self,
status: Option<&str>,
limit: i64,
) -> Result<Vec<IncidentRecord>, SlabError>
pub async fn list( &self, status: Option<&str>, limit: i64, ) -> Result<Vec<IncidentRecord>, SlabError>
Lists up to limit (clamped to 1..=500) incidents ordered by last_seen_at DESC on the read pool.
Pass status = Some("open"), Some("in_progress"), Some("resolved"), or Some("ignored")
to filter by lifecycle state, or None / Some("all") to return all incidents.
Sourcepub async fn get(&self, id: &str) -> Result<Option<IncidentRecord>, SlabError>
pub async fn get(&self, id: &str) -> Result<Option<IncidentRecord>, SlabError>
Fetches a single incident by its inc_<ulid> identifier on the read pool.
Sourcepub async fn claim(&self, id: &str, assignee: &str) -> Result<bool, SlabError>
pub async fn claim(&self, id: &str, assignee: &str) -> Result<bool, SlabError>
Atomically claims an "open" incident for assignee, transitioning it to "in_progress".
Returns true when the incident was open and claimed, or false if it does not exist,
was already claimed, or is not in the "open" state.
Sourcepub async fn link_external(
&self,
id: &str,
key: &str,
url: &str,
) -> Result<bool, SlabError>
pub async fn link_external( &self, id: &str, key: &str, url: &str, ) -> Result<bool, SlabError>
Links an external issue tracker key and http:// or https:// URL to an incident.
Returns true if a matching row was updated, or false if id does not exist.
Sourcepub async fn ignore(&self, id: &str) -> Result<bool, SlabError>
pub async fn ignore(&self, id: &str) -> Result<bool, SlabError>
Marks an incident as "ignored" and updates last_seen_at.
Future occurrences increment the counter and append to recent_occurrences_json without
reopening the incident or firing alert webhooks.
Sourcepub async fn resolve(
&self,
id: &str,
resolved_in_sha: Option<&str>,
) -> Result<bool, SlabError>
pub async fn resolve( &self, id: &str, resolved_in_sha: Option<&str>, ) -> Result<bool, SlabError>
Marks an incident as "resolved" with an optional resolved_in_sha, updating last_seen_at.
Returns true if a matching row was updated, or false if id does not exist.
Sourcepub async fn reopen(&self, id: &str) -> Result<bool, SlabError>
pub async fn reopen(&self, id: &str) -> Result<bool, SlabError>
Re-opens an incident by setting status = 'open', clearing resolved_in_sha and assignee,
and updating last_seen_at.
Returns true if a matching row was updated, or false if id does not exist.
Sourcepub async fn count_open(&self) -> Result<i64, SlabError>
pub async fn count_open(&self) -> Result<i64, SlabError>
Returns the number of currently open incidents on the read pool.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Incidents
impl !UnwindSafe for Incidents
impl Forget for Incidents
impl Freeze for Incidents
impl Move for Incidents
impl Send for Incidents
impl Sync for Incidents
impl Unpin for Incidents
impl UnsafeUnpin for Incidentswhere
*const ArcInner<PoolInner<Sqlite>> is !null: UnsafeUnpin,
PhantomData<ArcInner<PoolInner<Sqlite>>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read moreSource§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
413 Payload Too Large responses. Read more