Skip to content

Commit

Permalink
Introduce interface to export InvocationStatus (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper committed Jun 26, 2023
1 parent a41878a commit 001aca9
Show file tree
Hide file tree
Showing 6 changed files with 286 additions and 35 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/invoker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ bytes-utils = { workspace = true }
restate_common = { workspace = true, features = ["serde"] }
restate_hyper_util = { workspace = true }
restate_fs_util = { workspace = true }
restate_futures_util = { workspace = true }
drain = { workspace = true }
futures = { workspace = true }
hyper = { workspace = true, features = ["http1", "http2", "client", "tcp", "stream", "runtime"] }
Expand Down
17 changes: 11 additions & 6 deletions src/invoker/src/invocation_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use hyper::{http, Body, Request, Response, Uri};
use opentelemetry::propagation::TextMapPropagator;
use opentelemetry::sdk::propagation::TraceContextPropagator;
use opentelemetry_http::HeaderInjector;
use restate_common::errors::{InvocationError, UserErrorCode};
use restate_common::errors::{InvocationError, InvocationErrorCode, UserErrorCode};
use restate_common::types::{
EnrichedRawEntry, EntryIndex, PartitionLeaderEpoch, ServiceInvocationId,
ServiceInvocationSpanContext,
Expand Down Expand Up @@ -96,15 +96,20 @@ impl InvokerError for InvocationTaskError {
fn is_transient(&self) -> bool {
true
}
}

impl From<InvocationTaskError> for InvocationError {
fn from(value: InvocationTaskError) -> Self {
match value {
InvocationTaskError::Invocation(e) => e,
fn to_invocation_error(&self) -> InvocationError {
match self {
InvocationTaskError::Invocation(e) => e.clone(),
e => InvocationError::new(UserErrorCode::Internal, e.to_string()),
}
}

fn as_invocation_error_code(&self) -> InvocationErrorCode {
match self {
InvocationTaskError::Invocation(e) => e.code(),
_ => UserErrorCode::Internal.into(),
}
}
}

// Copy pasted from hyper::Error
Expand Down
Loading

0 comments on commit 001aca9

Please sign in to comment.