Documentation
¶
Overview ¶
Package timeoutcap reports a caller's timeout_seconds a ceiling replaced (#2210): a connection's call_timeout, which a caller may lower but never raise, or a deployment's export max_timeout. The cap is right, and it is reported so a caller who asked for more can see what was applied instead, and a call stopped by it says which limit that was.
Index ¶
Constants ¶
const ( CappedByCallTimeout = "connection call_timeout" CappedByExportMaxTimeout = "export max_timeout" )
What Cap.CappedBy names: the connection's call_timeout, or the deployment's export max_timeout, replacing a caller's longer timeout_seconds.
const CallTimeoutOwner = "the connection's call_timeout"
CallTimeoutOwner names the connection's own per-request limit in a timeout sentence.
Variables ¶
This section is empty.
Functions ¶
func Explain ¶
Explain is msg with the sentence a timed-out request is reported with in front of it, and msg unchanged when it is not a timeout.
func IsTimeout ¶
IsTimeout reports whether an error message carries a timeout signature: the stable phrases Go's net/http, context and net error types emit. A plain "timeout" substring is not matched, since the word can appear in an upstream's own text.
Types ¶
type Cap ¶
type Cap struct {
// AppliedSeconds is the timeout the call ran under.
AppliedSeconds int `json:"timeout_applied_seconds,omitempty"`
// CappedBy names the ceiling that replaced the caller's value.
CappedBy string `json:"timeout_capped_by,omitempty"`
// RequestedSeconds is the caller's own value.
RequestedSeconds int `json:"timeout_requested_seconds,omitempty"`
}
Cap reports a caller's timeout_seconds that a ceiling replaced. The zero value is no cap, and renders nothing.
func Apply ¶
Apply is the timeout one call runs under: the caller's requested seconds when they are positive and no longer than ceiling, else the ceiling; by names the ceiling in the report.