pub struct ClientTuning {
pub timeout: Option<Duration>,
pub retry: Option<RetrySettings>,
pub stream_reconnect: Option<ReconnectSettings>,
pub require_tls: Option<bool>,
pub circuit_breaker: Option<CircuitBreakerConfig>,
pub pool_max_idle_per_host: Option<usize>,
pub pool_idle_timeout: Option<Duration>,
pub max_concurrent_requests: Option<usize>,
pub internal_token_provider: Option<InternalTokenProvider>,
}Expand description
Fine-tuning knobs forwarded to the transport client when a remote
transport is selected. All fields are optional — missing values fall
back to the SDK defaults baked into
ClientConfig.
Fields§
§timeout: Option<Duration>Per-call request deadline (e.g., "5s", "500ms").
retry: Option<RetrySettings>Override for the retry policy applied to #[retryable] methods.
stream_reconnect: Option<ReconnectSettings>Override for the stream reconnect policy, of any framing.
alias = "sse_reconnect" keeps already-deployed config files working:
this struct has no rename_all, so the Rust field name is the JSON
key, and the field was called sse_reconnect before the policy covered
framings other than SSE.
Supplying both stream_reconnect and sse_reconnect is rejected as
a duplicate field — the two name the same field — so a config that adds
the new key without removing the legacy one fails loudly at parse time
rather than silently honouring one and dropping the other. This holds
even though the field is #[serde(flatten)]-ed into ClientWiring.
require_tls: Option<bool>Reject plaintext http:// endpoints.
Defaults to false (the in-mesh convention), or true when
toolkit-http/fips is enabled; there require_tls: false is the
explicit opt-in to plaintext and logs a warning. Without this knob a
discovery-resolved client always got the default, so a consumer talking
to an endpoint outside a trusted boundary had no way to demand TLS —
while forwarding a tenant bearer token over it.
circuit_breaker: Option<CircuitBreakerConfig>Circuit breaker for each endpoint this client calls. Missing keeps the
defaults (on: opens when at least half of at least 10 calls in 30s
failed at the transport level, open for 10s, then one probe);
{ enabled: false } turns it off. Unknown keys and invalid values are
rejected at parse time.
pool_max_idle_per_host: Option<usize>Max idle keep-alive connections per upstream host. Raise this to at least
the expected per-upstream request concurrency so HTTP/1.1 connections are
reused instead of churned under load. Missing keeps the SDK default
(ClientConfig::pool_max_idle_per_host).
REST transport only. A gRPC client accepts this key but it has no effect (a warning is logged when such a client is wired).
pool_idle_timeout: Option<Duration>How long idle keep-alive connections are retained (e.g. "90s", "2m")
before being closed and reopened on the next request. Companion of
pool_max_idle_per_host; raise it above the gap between successive bursts
to a given upstream to keep connections warm. Missing keeps the SDK
default (ClientConfig::pool_idle_timeout).
REST transport only (see pool_max_idle_per_host).
max_concurrent_requests: Option<usize>Max concurrent in-flight requests through this client at once. Requests
beyond the cap are shed immediately (HttpError::Overloaded). Keep it at
or above pool_max_idle_per_host so the pool can be fully reused. Missing
keeps the SDK default
(ClientConfig::max_concurrent_requests).
REST transport only (see pool_max_idle_per_host).
internal_token_provider: Option<InternalTokenProvider>Platform-plane credential source forwarded onto the built
ClientConfig. Injected by the
runtime’s proxy-wiring phase, never from config (#[serde(skip)]); gated
on runtime-client since the type lives there.
Implementations§
Source§impl ClientTuning
impl ClientTuning
Sourcepub const KEYS: &'static [&'static str]
pub const KEYS: &'static [&'static str]
Every key a ClientTuning reads. It is flattened into
ConsumerWiring and ClientWiring, so serde cannot reject unknown
keys there; the config reader checks against this list instead.
Sourcepub fn grpc_ignored_knobs(&self) -> Vec<&'static str>
pub fn grpc_ignored_knobs(&self) -> Vec<&'static str>
The knobs set on this tuning that a gRPC client does not apply.
Used to warn when a gRPC client is wired: it reads the endpoint,
timeout, retry, require_tls and circuit_breaker. The pool and
concurrency knobs are REST-only, and gRPC streams do not reconnect yet,
so stream_reconnect (or sse_reconnect) is not applied either.
Returns their names (empty when none are set).
Source§impl ClientTuning
impl ClientTuning
Sourcepub fn effective_require_tls(&self) -> bool
pub fn effective_require_tls(&self) -> bool
require_tls with the default applied: an unset value is false, or
true when toolkit-http/fips is on. Use this instead of reading the
Option directly; Self::apply_to resolves it the same way.
Sourcepub fn apply_to(&self, endpoint: impl Into<String>) -> ClientConfig
pub fn apply_to(&self, endpoint: impl Into<String>) -> ClientConfig
Apply tuning overrides onto a fresh [ClientConfig] built from endpoint.
Sourcepub fn circuit_breaker_for(&self, name: &str) -> Option<Arc<CircuitBreaker>>
pub fn circuit_breaker_for(&self, name: &str) -> Option<Arc<CircuitBreaker>>
The circuit breaker this tuning asks for, named name in logs and
rejections; None when it is turned off.
Sourcepub fn with_internal_token_provider(
self,
provider: Option<InternalTokenProvider>,
) -> ClientTuning
pub fn with_internal_token_provider( self, provider: Option<InternalTokenProvider>, ) -> ClientTuning
Attach the platform-plane credential source forwarded onto the built
ClientConfig. Used by the
proxy-wiring phase to thread the process credential into a
directory-resolving (#[toolkit::consumes]) client.
Trait Implementations§
Source§impl Clone for ClientTuning
impl Clone for ClientTuning
Source§fn clone(&self) -> ClientTuning
fn clone(&self) -> ClientTuning
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientTuning
impl Debug for ClientTuning
Source§impl Default for ClientTuning
impl Default for ClientTuning
Source§fn default() -> ClientTuning
fn default() -> ClientTuning
Source§impl<'de> Deserialize<'de> for ClientTuning
impl<'de> Deserialize<'de> for ClientTuning
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClientTuning, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClientTuning, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl !RefUnwindSafe for ClientTuning
impl !UnwindSafe for ClientTuning
impl Forget for ClientTuning
impl Freeze for ClientTuning
impl Move for ClientTuning
impl Send for ClientTuning
impl Sync for ClientTuning
impl Unpin for ClientTuning
impl UnsafeUnpin for ClientTuning
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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<'de, T> GtsDeserialize<'de> for Twhere
T: Deserialize<'de>,
impl<'de, T> GtsDeserialize<'de> for Twhere
T: Deserialize<'de>,
Source§fn gts_deserialize<__D>(
deserializer: __D,
) -> Result<T, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn gts_deserialize<__D>(
deserializer: __D,
) -> Result<T, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<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 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 catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. 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 moreSource§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>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§impl<T> WithSecurityContext for T
impl<T> WithSecurityContext for T
Source§fn security_ctx<'a>(&'a self, ctx: &'a SecurityContext) -> Secured<'a, T>where
T: Sized,
fn security_ctx<'a>(&'a self, ctx: &'a SecurityContext) -> Secured<'a, T>where
T: Sized,
Secured wrapper. Read more