Skip to content

Commit 24bfc83

Browse files
author
committed
Deployed dfd6f55 with MkDocs version: 1.6.1
1 parent e2e093f commit 24bfc83

3 files changed

Lines changed: 37 additions & 10 deletions

File tree

index.html

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,18 +1028,47 @@ <h2 id="errors">Errors<a class="headerlink" href="#errors" title="Permanent link
10281028
<ul>
10291029
<li><strong>Status errors</strong> (4xx/5xx responses) — raised automatically, no <code>raise_for_status()</code> needed: <code>NotFoundError</code>, <code>RateLimitedError</code>, <code>ServiceUnavailableError</code>, and the rest. All subclass <code>StatusError</code>.</li>
10301030
<li><strong>Transport errors</strong> — connection / network / protocol failures before a response arrived. <code>NetworkError</code> (transient) subclasses <code>TransportError</code>.</li>
1031-
<li><strong>Resilience refusals</strong><code>RetryBudgetExhaustedError</code> and <code>BulkheadFullError</code>, raised by the resilience middleware.</li>
1031+
<li><strong>Resilience refusals</strong><code>RetryBudgetExhaustedError</code>, <code>BulkheadFullError</code>, and <code>CircuitOpenError</code>, raised by the resilience middleware.</li>
10321032
<li><strong>Decode errors</strong><code>DecodeError</code>, raised when <code>response_model=</code> decoding fails (HTTP call itself succeeded). <code>MissingDecoderError</code>, raised when no registered decoder claims the <code>response_model=</code> type — fires <em>before</em> the HTTP call.</li>
10331033
</ul>
10341034
<p>See the <a href="errors/">Errors reference</a> for the full tree and catching strategies.</p>
10351035
<h2 id="observability">Observability<a class="headerlink" href="#observability" title="Permanent link">&para;</a></h2>
1036-
<p><code>AsyncRetry</code>/<code>Retry</code> and <code>AsyncBulkhead</code>/<code>Bulkhead</code> emit operational events via two channels — stdlib <code>logging</code> records (always on) and OpenTelemetry span events (when <code>opentelemetry-api</code> is installed). Event names and payloads are identical across sync and async; dashboards built against one class apply unchanged to the other.</p>
1037-
<p>Logger names (<code>httpware.retry</code>, <code>httpware.bulkhead</code>) and event names (<code>retry.giving_up</code>, <code>retry.budget_refused</code>, <code>retry.streaming_refused</code>, <code>bulkhead.rejected</code>) are the stable public contract.</p>
1036+
<p>All resilience middleware emit operational events via two channels — stdlib <code>logging</code> records (always on) and OpenTelemetry span events (when <code>opentelemetry-api</code> is installed). Event names and payloads are identical across sync and async; dashboards built against one class apply unchanged to the other.</p>
1037+
<p>Logger names and event names are the stable public contract:</p>
1038+
<table>
1039+
<thead>
1040+
<tr>
1041+
<th>Logger</th>
1042+
<th>Events</th>
1043+
</tr>
1044+
</thead>
1045+
<tbody>
1046+
<tr>
1047+
<td><code>httpware.retry</code></td>
1048+
<td><code>retry.giving_up</code>, <code>retry.budget_refused</code>, <code>retry.streaming_refused</code></td>
1049+
</tr>
1050+
<tr>
1051+
<td><code>httpware.bulkhead</code></td>
1052+
<td><code>bulkhead.rejected</code></td>
1053+
</tr>
1054+
<tr>
1055+
<td><code>httpware.circuit_breaker</code></td>
1056+
<td><code>circuit.opened</code> (WARNING), <code>circuit.rejected</code> (WARNING), <code>circuit.half_open</code> (INFO), <code>circuit.closed</code> (INFO)</td>
1057+
</tr>
1058+
<tr>
1059+
<td><code>httpware.timeout</code></td>
1060+
<td><code>timeout.exceeded</code> (WARNING)</td>
1061+
</tr>
1062+
</tbody>
1063+
</table>
1064+
<p>Each log record carries an <code>event</code> field with the event-name string (e.g. <code>event="circuit.opened"</code>), usable for log-aggregator filtering. See <a href="resilience/">resilience.md</a> for the full event tables per middleware.</p>
10381065
<div class="highlight"><pre><span></span><code><a id="__codelineno-8-1" name="__codelineno-8-1" href="#__codelineno-8-1"></a><span class="kn">import</span><span class="w"> </span><span class="nn">logging</span>
10391066
<a id="__codelineno-8-2" name="__codelineno-8-2" href="#__codelineno-8-2"></a>
1040-
<a id="__codelineno-8-3" name="__codelineno-8-3" href="#__codelineno-8-3"></a><span class="c1"># Enable visibility into retry / bulkhead operational events</span>
1067+
<a id="__codelineno-8-3" name="__codelineno-8-3" href="#__codelineno-8-3"></a><span class="c1"># Enable visibility into resilience operational events</span>
10411068
<a id="__codelineno-8-4" name="__codelineno-8-4" href="#__codelineno-8-4"></a><span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;httpware.retry&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">WARNING</span><span class="p">)</span>
10421069
<a id="__codelineno-8-5" name="__codelineno-8-5" href="#__codelineno-8-5"></a><span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;httpware.bulkhead&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">WARNING</span><span class="p">)</span>
1070+
<a id="__codelineno-8-6" name="__codelineno-8-6" href="#__codelineno-8-6"></a><span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;httpware.circuit_breaker&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">INFO</span><span class="p">)</span> <span class="c1"># INFO for recovery events</span>
1071+
<a id="__codelineno-8-7" name="__codelineno-8-7" href="#__codelineno-8-7"></a><span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="s2">&quot;httpware.timeout&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">setLevel</span><span class="p">(</span><span class="n">logging</span><span class="o">.</span><span class="n">WARNING</span><span class="p">)</span>
10431072
</code></pre></div>
10441073
<p>For OTel attribute enrichment on the active span — install the extra:</p>
10451074
<div class="highlight"><pre><span></span><code><a id="__codelineno-9-1" name="__codelineno-9-1" href="#__codelineno-9-1"></a>pip<span class="w"> </span>install<span class="w"> </span>httpware<span class="o">[</span>otel<span class="o">]</span>

resilience/index.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,9 +1469,7 @@ <h2 id="asyncretry"><code>AsyncRetry</code><a class="headerlink" href="#asyncret
14691469
</tr>
14701470
</tbody>
14711471
</table>
1472-
<p>For a whole-attempt wall-clock bound, use <code>httpx2.Timeout</code> on the client or
1473-
pass <code>timeout=</code> per request. <code>httpware</code> does not own a structured-cancellation
1474-
timeout knob.</p>
1472+
<p>For a whole-operation wall-clock bound across all retry attempts, compose <code>AsyncTimeout</code> outermost — see <a href="#asynctimeout">AsyncTimeout</a> below. For a per-request bound, use <code>httpx2.Timeout</code> on the client or pass <code>timeout=</code> per request.</p>
14751473
<h3 id="retry-after-parsing">Retry-After parsing<a class="headerlink" href="#retry-after-parsing" title="Permanent link">&para;</a></h3>
14761474
<p><code>Retry-After</code> is parsed as either:
14771475
- <strong>Integer seconds</strong><code>Retry-After: 30</code> → sleep 30s (clamped to <code>max_delay</code>)
@@ -1592,7 +1590,7 @@ <h2 id="asynccircuitbreaker-circuitbreaker"><code>AsyncCircuitBreaker</code> / <
15921590
<h3 id="states">States<a class="headerlink" href="#states" title="Permanent link">&para;</a></h3>
15931591
<ul>
15941592
<li><strong>CLOSED</strong> — normal operation. Each counted failure increments the consecutive-failure counter. Once <code>failure_threshold</code> consecutive counted failures accumulate, the circuit opens.</li>
1595-
<li><strong>OPEN</strong> — fast-fail. All requests are rejected immediately with <code>CircuitOpenError</code> (carrying <code>retry_after</code> seconds until the next probe window). After <code>reset_timeout</code> seconds the circuit moves to HALF_OPEN.</li>
1593+
<li><strong>OPEN</strong> — fast-fail. While elapsed time is below <code>reset_timeout</code>, requests are rejected immediately with <code>CircuitOpenError</code> (carrying <code>retry_after</code> seconds until the next probe window). The first request after <code>reset_timeout</code> elapses transitions the circuit to HALF_OPEN and becomes the probe.</li>
15961594
<li><strong>HALF_OPEN</strong> — exactly one probe is admitted. If <code>success_threshold</code> consecutive probe successes are observed, the circuit closes. A single probe failure re-opens the circuit.</li>
15971595
</ul>
15981596
<h3 id="constructor">Constructor<a class="headerlink" href="#constructor" title="Permanent link">&para;</a></h3>
@@ -1807,7 +1805,7 @@ <h3 id="retry"><code>Retry</code><a class="headerlink" href="#retry" title="Perm
18071805
</tbody>
18081806
</table>
18091807
<p><code>Retry</code> uses <code>time.sleep</code> between attempts. <code>Retry-After</code>, streaming-body refusal, exhaustion behavior, and <code>RetryBudgetExhaustedError</code> semantics are identical to <code>AsyncRetry</code>.</p>
1810-
<p>For a whole-attempt wall-clock bound, use <code>httpx2.Timeout</code> on the wrapped client or pass <code>timeout=</code> per request. <code>httpware</code> does not own a structured-cancellation timeout knob.</p>
1808+
<p>For a whole-attempt wall-clock bound, use <code>httpx2.Timeout</code> on the wrapped client or pass <code>timeout=</code> per request. No sync <code>Timeout</code> middleware exists — sync Python has no cancellation primitive that can interrupt a blocking call mid-flight.</p>
18111809
<h3 id="bulkhead"><code>Bulkhead</code><a class="headerlink" href="#bulkhead" title="Permanent link">&para;</a></h3>
18121810
<div class="highlight"><pre><span></span><code><a id="__codelineno-15-1" name="__codelineno-15-1" href="#__codelineno-15-1"></a><span class="kn">from</span><span class="w"> </span><span class="nn">httpware.middleware.resilience</span><span class="w"> </span><span class="kn">import</span> <span class="n">Bulkhead</span>
18131811
</code></pre></div>

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)