<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Observing with Stella]]></title><description><![CDATA[Welcome to my personal engineering corner. I write about making complex distributed systems highly observable, architecting vendor-neutral data pipelines, and n]]></description><link>https://stellahu.me</link><image><url>https://cdn.hashnode.com/uploads/logos/6a0bbb254e81b73048c4a9bd/3c27bfae-71fe-4fd5-aa3c-a971f16f8170.jpg</url><title>Observing with Stella</title><link>https://stellahu.me</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Nov 2026 00:59:01 GMT</lastBuildDate><atom:link href="https://stellahu.me/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Observing the Observer: 
OTel Collector Dashboards Done Right]]></title><description><![CDATA[Almost every platform or observability team has stood up an OTel Collector, watched spans flow cleanly through staging, and shipped it, only to find silent…]]></description><link>https://stellahu.me/observing-the-observer-otel-collector-dashboards-done-right</link><guid isPermaLink="true">https://stellahu.me/observing-the-observer-otel-collector-dashboards-done-right</guid><dc:creator><![CDATA[Stelle Hu]]></dc:creator><pubDate>Mon, 01 Jun 2026 11:59:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a0bbb254e81b73048c4a9bd/22de5608-f94a-4af4-a18b-ef8a3d6063e5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Almost every platform or observability team has stood up an OTel Collector, watched spans flow cleanly through staging, and shipped it, only to find silent export failures, dropped logs, or a growing queue backlog sometime in the first week of real traffic.</p>
<p>Not because anyone was careless, but because <strong>"data is flowing"</strong> and <strong>"the pipeline is observable"</strong> are genuinely different bars, and most teams never build the visibility to know which one they're actually at.</p>
<p>This post is a concrete guide to building a dashboard that tells you the truth about your OTel Collector, covering the right metrics, query design decisions, and layout principles that make the difference between a dashboard that looks fine and one that's actually useful at 3am.</p>
<p>The context throughout: a Collector receiving from OTLP endpoints, processing through multiple components, and exporting to Datadog (primary) and S3 (archive).</p>
<hr />
<h2>Get Your Queries Right First</h2>
<p>Dashboard panels are only as trustworthy as the queries behind them. Two tiny decisions made wrong here will silently undermine everything else.</p>
<p><code>sum</code> <strong>vs</strong> <code>avg</code><strong>:</strong> For throughput metrics, received, sent, and failed, always use <code>sum by</code>. You want total volume across all Collector instances. <code>avg</code> silently undercounts in any scaled-out deployment and makes your pipeline look quieter than it is. The only place <code>avg</code> makes sense is resource metrics like CPU or memory per instance.</p>
<p><code>count</code> <strong>vs</strong> <code>rate</code><strong>:</strong> Use <code>.as_rate()</code>. Received, sent, and failed are <strong>monotonic</strong> counters, and rate normalises them per second for a consistent throughput view regardless of query interval.</p>
<p>Beyond those two: use <code>default_zero</code> to prevent misleading gaps, scope every query with <code>\(env</code> and <code>\)collector_instance</code> template variables, and keep rollup windows consistent across side-by-side panels. Mismatched rollups make drops look larger or smaller than they actually are.</p>
<hr />
<h2>What Actually Matters to Monitor</h2>
<p>The Collector emits a lot of metrics. Most of them are noise at 3am. These are the ones that matter.</p>
<p><strong>Throughput</strong> is your baseline: <code>otelcol_receiver_accepted_*</code> vs <code>otelcol_exporter_sent_*</code> per signal type. If those two numbers diverge, something in between is eating data.</p>
<p><strong>Data loss</strong> is your critical surface: <code>receiver_refused_*</code>, <code>exporter_failed_*</code>, and <code>exporter_enqueue_failed_*</code>. These should be zero. Always. Alert on anything that isn't.</p>
<p><strong>Queue depth</strong> is your early warning: queue size against capacity tells you whether the exporter is keeping up. Alert at 80% utilisation, not 100%, because by then you're already losing data.</p>
<p><strong>Processor metrics</strong> worth watching: the batch processor's timeout vs size trigger ratio (high timeout ratio means data is sitting waiting), and <code>batch_metadata_cardinality</code> (high cardinality causes memory bloat that eventually triggers the memory limiter). If you're running tail sampling, <code>sampling_decision_latency</code> can become a pipeline stall that shows up nowhere else.</p>
<hr />
<h2>Layout: Top-Down by Urgency</h2>
<p>The structure follows one principle: <strong>top rows answer "is data being lost?", middle rows answer "where and why?", the bottom row answers "is the Collector itself healthy?"</strong>. You should be able to call the pipeline healthy or broken from the top section alone.</p>
<p><strong>Pipeline Overview</strong> is fully aggregated with no splitting. Scorecards for Total Received, Exported, Refused, Failed, and Queue Utilisation %. Add conditional colour thresholds to Queue Utilisation (green below 50%, amber to 80%, red above) so it communicates status without requiring interpretation. This row should be boring on a good day.</p>
<p><strong>Per-Signal Pipelines</strong> give Spans, Metrics, and Logs each their own collapsible section: scorecards plus a Received vs Exported time series plus a separate Refused and Failed panel. A few details that matter: add a % exported ratio scorecard ("99.8% exported" is more readable than mentally comparing two large numbers), use contrasting line styles for received vs exported so divergence is visible before you check the legend, and ensure Refused/Failed panels auto-scale from zero rather than sitting on a fixed axis that makes every flat line look identical. For Logs specifically, split by <code>receiver</code> tag, since log sources are more varied and source-specific failures hide easily in an aggregate.</p>
<p><strong>Processor Funnel</strong> shows volume at each processor stage in order. This is the single panel that makes data loss immediately locatable. Show dropped items as positive values, since negative numbers require a mental inversion that costs time you don't have. Document each processor's purpose in a text widget; anyone unfamiliar with the pipeline will thank you.</p>
<p><strong>Exporter Health by Destination</strong> treats Datadog and S3 as what they are: two exporters with different criticality. Datadog failures should page immediately. S3 failures are silent today but permanent, since data loss in an archive is unrecoverable. Show them separately. Tag exporters with <code>criticality:primary</code> vs <code>criticality:archive</code> via the transform processor so alert queries don't hardcode exporter names and break the next time the pipeline changes.</p>
<p><strong>Latency Proxies</strong> exist because the Collector has no native end-to-end latency metric. Approximate it with queue depth over time (growing queue means growing latency) and the batch timeout trigger ratio (high timeout ratio means data is sitting waiting). For teams with actual SLOs, invest in a synthetic heartbeat, a known span sent through the real pipeline at regular intervals with a known emission timestamp, measured on arrival at Datadog. It's the only way to get true wall clock latency across every stage without custom instrumentation.</p>
<p><strong>Process Health</strong> covers Memory RSS, CPU (in percentage or millicores, not raw units), and Go heap allocation, which is spiky due to GC. Correlate with <code>go_gc_duration_seconds</code> to confirm it's GC and not a leak. This section lives at the bottom because it's context, not your primary signal.</p>
<hr />
<h2>The Gaps That Will Hurt You First</h2>
<p>Silent data loss between a receiver and exporter with no visibility into which processor caused it. An S3 export failing for three days before anyone notices because it's aggregated with Datadog. Queue saturation that looks like a healthy flat line because the panel's y-axis was never configured. A Logs pipeline spiking from a single source that's invisible in an aggregate view.</p>
<p>None of these are exotic failure modes. They're the ones that happen first.</p>
<p>A dashboard that makes them visible in under 30 seconds isn't a nice-to-have. It's the difference between an incident that gets caught in minutes and one that becomes a week-long data gap in your archive.</p>
]]></content:encoded></item><item><title><![CDATA[Pipelines Don’t Go Down Cleanly — They Fall Behind]]></title><description><![CDATA[Your pipeline deployed cleanly. Six hours into real production traffic, someone notices a gaping hole in their dashboards, three hours of logs are silently…]]></description><link>https://stellahu.me/pipelines-don-t-go-down-cleanly-they-fall-behind</link><guid isPermaLink="true">https://stellahu.me/pipelines-don-t-go-down-cleanly-they-fall-behind</guid><dc:creator><![CDATA[Stelle Hu]]></dc:creator><pubDate>Mon, 25 May 2026 02:57:02 GMT</pubDate><content:encoded><![CDATA[<p>Your pipeline deployed cleanly. Six hours into real production traffic, someone notices a gaping hole in their dashboards, three hours of logs are silently missing. There are no errors. There are no alerts. The pipeline simply fell behind under load and quietly dropped what it couldn't catch up on.</p>
<p>That is the exact failure mode that makes telemetry pipelines different. It is rarely a clean, loud outage. Instead, it is a slow bleed that only surfaces when someone goes looking, usually at the worst possible time during an active incident.</p>
<p><em>Note: The foundational architecture from Post 1 and the fault isolation principles from Post 2 still apply. Everything discussed here handles the unique mechanics of continuous data ingestion.</em></p>
<hr />
<h2>Use example of Telemetry Pipeline</h2>
<p>Think of a telemetry pipeline as the exact opposite of a traditional web service. A web service waits for an inbound request to ask it something. A pipeline never stops, instead it moves data continuously from where it's produced to where it's useful, whether anyone is watching or not.</p>
<h3>The Streaming Topology</h3>
<p>The data flow moves continuously across decoupled boundaries:</p>
<pre><code class="language-plaintext">Producers          Telemetry Pipeline           Sinks
───────────────────────────────────────
Services─┐                              ┌─►Datadog(Metrics)
Agents  ─┼►[Ingest]─►[Buffer/Process]┼─►Datadog(APM)
Infra   ─┘                              └─► ClickHouse(Logs)
</code></pre>
<blockquote>
<p><strong>Continuous inbound flow. N processing stages. N outbound sinks.</strong></p>
</blockquote>
<p>There is no request boundary, and no natural unit of success or failure. Data flows, or it doesn't, and without the right signals, you will find out far too late.</p>
<hr />
<h2>1. Observability: Your Dashboard Is Lying to You</h2>
<p>Your overall pipeline error rate sits at a comfortable <strong>1.3%</strong>. Looks healthy, right? Hidden deep inside that blended average, one isolated processing stage is silently dropping <strong>40% of events</strong> coming from a single critical source.</p>
<p>You must tag every single metric by both stage and source, never blend them. If you cannot answer <em>"<strong><strong>which stage is degraded right now?</strong></strong>"</em> from a single dashboard view, your observability is doing you a disservice.</p>
<p>Beyond standard golden signals, pipelines require two unique telemetry metrics:</p>
<h3>A. Consumer Lag: Your Actual Heartbeat</h3>
<pre><code class="language-text">Queue Depth:  [■■■■■■■■■■■■■■■■■■■■] ◄── Producers writing here
                             ▲
Consumer State: [■■■■■■■■■■■■]       ◄── Workers processed up to here
                             └─── Lag = This Gap
</code></pre>
<ul>
<li><p><strong>Flat Lag:</strong> Your consumers are keeping pace with production.</p>
</li>
<li><p><strong>Growing Lag:</strong> Your consumers are falling behind. If lag hits your upstream retention window, you will begin losing data permanently with no errors, no alerts, just complete absence. <strong>This is the metric that should wake you up at 3:00 AM, not CPU.</strong></p>
</li>
</ul>
<h3>B. Data Completeness Rate</h3>
<p>A pipeline can have zero processing errors and still be missing entire source streams because an upstream agent crashed or a network path went dark. Error rates will never catch this because there are no errors to count, just silence.</p>
<p>You must track expected events per source per time window against actual received events. When a source goes quiet, you want an immediate alert, not a post-mortem ticket on Tuesday morning.</p>
<h3>The Three Pipeline Dashboard Layers</h3>
<table>
<thead>
<tr>
<th>Layer</th>
<th>Focus</th>
<th>Metrics Included</th>
<th>Target Audience / Use Case</th>
</tr>
</thead>
<tbody><tr>
<td><strong>1. Pipeline Health</strong></td>
<td>Blended signals</td>
<td>Overall throughput, global error rates</td>
<td>Initial Triage</td>
</tr>
<tr>
<td><strong>2. Stage Deep-Dive</strong></td>
<td>Per-stage &amp; per-source</td>
<td>Processing latency, per-source completeness</td>
<td>Deep Diagnosis</td>
</tr>
<tr>
<td><strong>3. Data SLI</strong></td>
<td>End-to-end metrics</td>
<td>End-to-end latency, completeness rate</td>
<td>Customer Impact</td>
</tr>
</tbody></table>
<hr />
<h2>2. Negotiate SLAs Before Writing Alert Thresholds</h2>
<p>Your completeness targets mean nothing without explicit agreements with the engineering teams whose data you are carrying. Crucially, these agreements are not uniform, and they should not.</p>
<p>For each upstream source, explicitly negotiate three parameters:</p>
<pre><code class="language-markdown">1. Latency SLA ----------- How fresh does data need to be at the sink? (Sets pipeline SLO)
2. Availability --------- Expected uptime of this source? (Drives completeness thresholds)
3. Acceptable Staleness -- How old is too old? (Drives cache TTL &amp; fallback strategy)
</code></pre>
<h3>The Operational Trade-off</h3>
<p>When a source degrades, you must choose your failure mode before the incident forces it on you:</p>
<ul>
<li><p><strong>Serve Partial (Completeness takes the hit):</strong> Return what arrived and skip the degraded source. You maintain current data, but it is incomplete.</p>
</li>
<li><p><strong>Serve Stale (Freshness takes the hit):</strong> Fall back to the last-known-good state from a cache. Your data remains complete, but old.</p>
</li>
</ul>
<hr />
<h2>3. Ingestion: Machines Have No Manners</h2>
<p>Human traffic has natural, smooth curves. Machine traffic is completely feral.</p>
<p>Every single service instance in your fleet will flush its 60-second metric batch at the exact same second. Your ingestion layer will routinely experience traffic spikes that look identical to a distributed denial-of-service (DDoS) attack. This isn't an anomaly; it's just Tuesday.</p>
<p>Build your ingestion layers for the peak spike, not the rolling average.</p>
<h3>The Ingestion Trade-off Matrix</h3>
<table>
<thead>
<tr>
<th>Data Type</th>
<th>Drop Under Pressure?</th>
<th>Verdict</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Metrics &amp; Traces</strong></td>
<td>Yes</td>
<td>A sampled representation is still highly useful. <strong>Lossy ingestion is fine.</strong></td>
</tr>
<tr>
<td><strong>Application Logs</strong></td>
<td>Depends</td>
<td>Align explicitly with your team's retention policies. Document the choice.</td>
</tr>
<tr>
<td><strong>Audit &amp; Billing Events</strong></td>
<td><strong>No</strong></td>
<td>Missing events represent a data integrity incident. <strong>Must be lossless.</strong></td>
</tr>
</tbody></table>
<hr />
<h2>4. Buffering: The Shock Absorber You Cannot Skip</h2>
<p>Placing an explicit storage buffer between your ingestion endpoints and your processing workers decouples your architecture completely:</p>
<pre><code class="language-text">Without Buffer:  Producer ──► [ Processing ] ──► Sink (If Sink drops, producers block or data dies)
With Buffer:     Producer ──► [ Durable Queue ] ──► [ Processing ] ──► Sink (Queue absorbs load if Sink drops)
</code></pre>
<p>Whether you choose Kafka, Pulsar, Kinesis, or GCP Pub/Sub matters less than the intentionality of the decoupling.</p>
<h3>Three Rules to Save Your Production State</h3>
<ol>
<li><p><strong>Dead Letter Queues (DLQs) are non-negotiable:</strong> Malformed, poisoned, or repeatedly failing events must be shunted to an inspectable, replayable storage bucket. You <em>will</em> need to replay from a DLQ eventually build the tooling before you need it.</p>
</li>
<li><p><strong>Set retention based on recovery windows:</strong> How long can your downstream sinks sit completely offline before you experience irreversible data loss? That operational timeframe sets your queue retention config rather an arbitrary default.</p>
</li>
<li><p><strong>Batch writes on hot paths:</strong> Writing synchronously to a queue per event at high volume will destroy throughput. Batch events aggressively. The trade-off is a tiny data-loss window if a process crashes.</p>
</li>
</ol>
<h3>Handling Queue Pile-Ups</h3>
<p>When a queue grows past its threshold, your system must execute a explicit, deterministic strategy:</p>
<ul>
<li><p><strong>Option A: Shed Load (Drop Tail).</strong> Purge the oldest or lowest-priority events at a specific threshold. This protects pipeline stability at the cost of deliberate data loss.</p>
</li>
<li><p><strong>Option B: Backpressure.</strong> Signal upstream producers to slow down. This guarantees no data loss, but propagates execution pressure directly back to your live application services.</p>
</li>
<li><p><strong>Option C: Scale Out Consumers.</strong> Burn down the queue backlog by dynamically adding processing capacity. This avoids data loss and upstream impact, but <strong>only works if the bottleneck is compute-bound</strong>, not a rate-limited or struggling downstream sink.</p>
</li>
</ul>
<hr />
<h2>5. Advanced Reliability: The Small Things That Bite Hard</h2>
<ul>
<li><p><strong>Graceful Draining:</strong> When a pipeline stage restarts, it must process all in-flight messages before exiting. A hard kill mid-batch forces re-processing on restart, which is fine if your downstream sinks are completely idempotent, but an absolute mess if they aren't. Always implement and test shutdown hooks.</p>
</li>
<li><p><strong>Idempotent Sink Writes:</strong> Your sinks <em>will</em> receive duplicate events under normal at-least-once streaming delivery. Implement upserts, deduplication keys, or content-addressed storage long before your first production replay.</p>
</li>
<li><p><strong>Clock Skew Across Environments:</strong> Collecting logs on GCP and processing them on AWS ECS? Independent NTP configurations can introduce subtle clock skews. A 200ms misalignment is invisible in standard contexts but quietly corrupts time-windowed aggregations. <strong>Normalize all timestamps to UTC at the point of emission</strong>, never at the sink.</p>
</li>
</ul>
<hr />
<h2>6. Scaling on the Correct Signal</h2>
<p>If your pipeline is falling behind, your consumer lag is growing, but your CPU usage sits at an idle 22%, a standard autoscaler will do nothing. Your data will hit its retention limit and vanish. The bottleneck is almost always a slow sink write, making your pipeline heavily I/O-bound.</p>
<p>Use platforms like Vector to scale workloads natively based on consumer lag metrics. On AWS ECS, publish queue lag as a custom CloudWatch metric to drive your scaling alarms. <strong>Scale your infrastructure before lag becomes a data loss risk, not after.</strong></p>
<hr />
<h2>7. Security: Two Things That Always Get Skipped</h2>
<ol>
<li><p><strong>Authenticate your producers:</strong> An unauthenticated ingestion endpoint accepting arbitrary JSON payloads is a severe event injection vector and an exfiltration surface. Enforce mTLS or token-based authentication even for internal agents.</p>
</li>
<li><p><strong>Scrub PII as early as possible:</strong> Every architectural hop that unmasked Personally Identifiable Information (PII) travels through, your queue, your state store, your replay buckets, quietly expands your compliance audit scope. <strong>Build tokenization and regex redaction patterns directly into your ingestion gateway</strong>, never as a cleanup step at the end.</p>
</li>
</ol>
<hr />
<h2>Summary</h2>
<p>You are not building a simple service that shuffles data from point A to point B. <strong>You are building a fault isolation layer that happens to be shaped like a pipeline.</strong></p>
<p>When designed correctly, your data consumers will always know exactly what they received, how complete it was, how fresh it was, and how to replay it if an outage occurs. That transparency is your architectural contract, everything else is just the infrastructure built to protect it.</p>
]]></content:encoded></item><item><title><![CDATA[Aggregators Don’t Crash Cleanly — They Rot]]></title><description><![CDATA[What breaks differently when your service has to ask five friends before it can answer one question]]></description><link>https://stellahu.me/aggregators-don-t-crash-cleanly-they-rot</link><guid isPermaLink="true">https://stellahu.me/aggregators-don-t-crash-cleanly-they-rot</guid><dc:creator><![CDATA[Stelle Hu]]></dc:creator><pubDate>Mon, 25 May 2026 02:38:55 GMT</pubDate><content:encoded><![CDATA[<p>Your service returned a <code>200 OK</code>. Yet, three of the five downstream dependencies it called were actively struggling. Nobody got paged.</p>
<p>That is the exact failure mode that makes aggregators different. It is rarely a clean, loud crash. Instead, it’s a quiet degradation where your health dashboard looks green, your error rate looks fine, and your users are receiving a hollow shell of a response—missing prices, empty recommendations, and stale inventory.</p>
<p><em>Note: Baseline architectural principles still apply here. Everything discussed below is additive.</em></p>
<hr />
<h2>What is a Fan-Out Assembler?</h2>
<p>A <strong>Fan-Out Assembler</strong> (or Aggregator) is a service whose job is to compose a response from sources it doesn't own. It calls the upstream services that do, assembles the results, and hands the payload back as if it came from a single source. The caller shouldn't know—or care—how many systems contributed behind the scenes.</p>
<p>This pattern shows up everywhere:</p>
<ul>
<li><p><strong>E-commerce:</strong> A product page API calling inventory, pricing, and recommendations in parallel.</p>
</li>
<li><p><strong>Fintech:</strong> A checkout service calling fraud scoring, payment availability, and promotions.</p>
</li>
<li><p><strong>AI Platform:</strong> An orchestration layer assembling multiple tool and LLM results into a single response.</p>
</li>
</ul>
<h3>The Structural Signature</h3>
<p>The anatomy of a fan-out request always looks like this:</p>
<pre><code class="language-text">                  ┌→ Inventory
Inbound request ──┼→ Pricing ────────→ Assembled response
                  ├→ Recommendations
                  └→ Promotions
</code></pre>
<blockquote>
<p><strong>One inbound request. \(N\) outbound calls. One assembled response.</strong></p>
</blockquote>
<p>That exact multiplication is what makes standard system concerns harder—and introduces entirely new failure modes.</p>
<hr />
<h2>1. Observability: Stop Blending Your Signals</h2>
<p>Your overall error rate sits at a comfortable <strong>1.2%</strong>. Looks healthy, right?</p>
<p>Hidden deep inside that average, the pricing service is failing at <strong>18%</strong> while everything else is clean. Your blended metric just buried a severe production issue.</p>
<p>You must tag every single metric per upstream—including latency histograms, error counters, and timeout rates. If you cannot answer <em>"which upstream is degraded right now?"</em> from a single dashboard view, your observability is lying to you by omission.</p>
<h3>The Three Dashboard Layers Worth Building</h3>
<table>
<thead>
<tr>
<th>Layer</th>
<th>Focus</th>
<th>Metrics Included</th>
<th>Target Audience / Use Case</th>
</tr>
</thead>
<tbody><tr>
<td><strong>1. Service Health</strong></td>
<td>Blended signals</td>
<td>Overall throughput, average error rates</td>
<td>Initial Triage</td>
</tr>
<tr>
<td><strong>2. Dependency Deep-Dive</strong></td>
<td>Per-upstream metrics</td>
<td>Per-service latency histograms, specific timeouts</td>
<td>Deep Diagnosis</td>
</tr>
<tr>
<td><strong>3. Business / SLI</strong></td>
<td><strong>Completeness rate</strong></td>
<td>Percentage of partial vs. full responses</td>
<td>User Impact</td>
</tr>
</tbody></table>
<p>That third layer—the <strong>completeness SLI</strong>—is unique to assemblers and the most commonly missing. A response with empty recommendations isn't a <code>500 Internal Server Error</code>, but it isn't healthy either. Without a completeness SLI, you have zero visibility into actual user experience.</p>
<hr />
<h2>2. Negotiate SLAs Before Writing Alert Thresholds</h2>
<p>Your alert thresholds are meaningless without explicit agreements with each upstream team. Crucially, these agreements are not uniform.</p>
<ul>
<li><p><strong>The Pricing Team</strong> needs guaranteed delivery. Missing prices in a checkout flow is a Severity-1 incident, regardless of cause.</p>
</li>
<li><p><strong>The Recommendations Team</strong> cares about responsiveness over completeness. A stale cache is perfectly fine; a slow response that degrades overall page load is unacceptable.</p>
</li>
<li><p><strong>The Inventory Team</strong> has a staleness window. Data that is 5 seconds old is fine; data that is 5 minutes old means you are selling out-of-stock items.</p>
</li>
</ul>
<p>For every single upstream, explicitly negotiate and document three core parameters:</p>
<pre><code class="language-markdown">1. Latency SLA ----------- Max acceptable response time? (Drives timeout configs)
2. Availability --------- Expected uptime? (Drives circuit breaker thresholds)
3. Acceptable Staleness -- How old is too old? (Drives cache TTL &amp; fallback logic)
</code></pre>
<h3>The Architectural Trade-off</h3>
<p>This negotiation forces the <strong>completeness vs. freshness</strong> trade-off into the open. When an upstream is degraded, do you serve partial data (completeness takes the hit) or serve stale cache (freshness takes the hit)?</p>
<p>The right answer follows from what the upstream team agreed their data is for. If that agreement doesn't exist, your service will make the decision implicitly under pressure—which is the worst possible time to find out.</p>
<hr />
<h2>3. Resilience: These Patterns Only Work Together</h2>
<p>Timeout, circuit breaker, bulkhead—you need <strong>all three</strong>. If you miss even one, the others cannot fully protect your system.</p>
<ul>
<li><p><strong>Timeouts alone:</strong> You keep hammering a struggling upstream, effectively becoming the attacker on a service desperately trying to recover.</p>
</li>
<li><p><strong>Circuit breakers alone:</strong> Breakers trip on error rates, not pure latency. A slow upstream taking 8000ms may never trip the breaker, but it will exhaust your thread pool.</p>
</li>
<li><p><strong>Both together, without bulkheads:</strong> One slow upstream still starves all the others. Shared connection pools mean one bad dependency takes down entirely unrelated requests.</p>
</li>
</ul>
<h3>The Solution: Complete Isolation</h3>
<pre><code class="language-text">[Tight Timeouts] ──&gt; Feeds failures into breaker fast ──&gt; Upstream gets breathing room
[Bulkheads] ───────&gt; Dedicates pools per upstream ───────&gt; Keeps blast radius contained
</code></pre>
<p>Bulkheads are the most commonly skipped pattern. Dedicate separate connection pools per upstream. It is as much a diagnostic tool as a resilience one—when pools are isolated, a failure is immediately attributable.</p>
<blockquote>
<p>💡 <strong>Don't forget Deadline Propagation:</strong> When your caller has already timed out upstream, <strong>stop execution</strong>. Burning I/O on a response nobody will ever receive steals capacity from live requests. Pass a deadline through the call chain (native in gRPC, or via an <code>X-Request-Deadline</code> header) and verify it before making any outbound call.</p>
</blockquote>
<hr />
<h2>4. Partial Failure Is a Contract, Not an Accident</h2>
<p>When an upstream degrades, your service <em>will</em> make a decision. The question is whether that decision was made deliberately in a design meeting or emergently at 3:00 AM.</p>
<p>Every upstream must be explicitly classified:</p>
<ul>
<li><p><strong>Required Upstream:</strong> If degraded, fail the entire request. No partial response makes sense without this data. <em>(Example: Payment availability in a checkout flow)</em></p>
</li>
<li><p><strong>Optional Upstream:</strong> If degraded, fallback to partial data or a stale cache. The response remains meaningful. <em>(Example: Product recommendations)</em></p>
</li>
</ul>
<p>Document this classification, wire it into your fallback logic, and make the behavior observable. Log exactly which upstreams contributed to each response and whether any fell back. When a user reports missing data, you need to know in seconds whether it was an intended fallback or a native bug.</p>
<hr />
<h2>5. Operations: Reducing Blast Radius</h2>
<h3>Runtime Kill-Switches</h3>
<p>This is the most operationally vital pattern in this post, yet the most commonly absent.</p>
<ul>
<li><p><strong>Without a kill-switch:</strong> Detect ➔ Diagnose ➔ Write PR ➔ Wait for CI/CD deploy ➔ <strong>10+ minutes of downtime.</strong></p>
</li>
<li><p><strong>With a kill-switch:</strong> Detect ➔ Diagnose ➔ Toggle Feature Flag ➔ <strong>Contained in under 60 seconds.</strong></p>
</li>
</ul>
<p>Whether you use LaunchDarkly, Unleash, AWS AppConfig, or a polled Parameter Store value—implementation matters less than existence.</p>
<h3>Scale on I/O Signals, Not CPU</h3>
<p>Assemblers are fundamentally I/O-bound. Your CPU will sit idle while threads block waiting on slow upstreams. Scale your infrastructure based on <strong>queue depth, pool saturation, or latency percentiles</strong>. If you inherited a default CPU-based autoscaling config, change it.</p>
<h3>Model Your End-to-End Timeout Arithmetic</h3>
<p>Your total end-to-end timeout must be logically less than your upstream call sequence. If you are calling three upstreams in parallel with 500ms timeouts, your assembler's overall timeout needs to account for that parallel execution plus internal processing overhead—do not just guess a number.</p>
<hr />
<h2>The Assembler Readiness Checklist</h2>
<h3>🟢 Phase 1: Go-Live Gates (All must be YES)</h3>
<ul>
<li><p>[ ] Are metrics tagged per upstream rather than blended?</p>
</li>
<li><p>[ ] Is there a completeness SLI tracking partial responses?</p>
</li>
<li><p>[ ] Have latency, availability, and staleness SLAs been agreed upon with each upstream team?</p>
</li>
<li><p>[ ] Is every upstream explicitly classified as either Required or Optional?</p>
</li>
<li><p>[ ] Is fallback behavior explicitly defined and observable for every upstream?</p>
</li>
<li><p>[ ] Does every upstream have a dedicated connection pool (bulkhead)?</p>
</li>
<li><p>[ ] Does every external call have a tight, explicitly bounded timeout?</p>
</li>
<li><p>[ ] Is deadline propagation implemented across the execution chain?</p>
</li>
</ul>
<h3>🔵 Phase 2: Operational Excellence</h3>
<ul>
<li><p>[ ] Is there a runtime kill-switch per upstream, operable without a deployment?</p>
</li>
<li><p>[ ] Is autoscaling driven by I/O saturation or latency instead of CPU usage?</p>
</li>
<li><p>[ ] Has chaos testing (fault injection) been run per upstream to verify fallbacks trigger automatically?</p>
</li>
<li><p>[ ] Has the end-to-end timeout math been modeled explicitly against upstream parallel call arithmetic?</p>
</li>
</ul>
<hr />
<h2>Summary</h2>
<p>You are not just building a service that happens to call multiple upstreams. <strong>You are building a fault isolation layer.</strong></p>
<p>When designed correctly, your callers will always know exactly what they got, how complete it was, and how fresh it was. That transparency is your architectural contract—everything else is just the infrastructure keeping it alive.</p>
]]></content:encoded></item><item><title><![CDATA[Production-Ready Is Not a Feeling ]]></title><description><![CDATA[Production-ready beats "working in staging." A pragmatic guide to observability, alerting, deployment gates, and resilience to survive on-call fatigue]]></description><link>https://stellahu.me/production-ready-is-not-a-feeling</link><guid isPermaLink="true">https://stellahu.me/production-ready-is-not-a-feeling</guid><category><![CDATA[production readiness]]></category><category><![CDATA[observability]]></category><category><![CDATA[insights]]></category><category><![CDATA[Operational-excellence ]]></category><category><![CDATA[Devops]]></category><category><![CDATA[SRE]]></category><dc:creator><![CDATA[Stelle Hu]]></dc:creator><pubDate>Tue, 19 May 2026 12:22:10 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a0bbb254e81b73048c4a9bd/af849d66-afb3-432b-aa10-6b11368b4e8c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>"It works in staging" is not a deployment strategy.</p>
<p>Almost every engineering team has shipped something that technically passed CI, survived unit tests with over 80% coverage, and promptly became a 3am incident within its first week of real traffic. Not because anyone was careless, but because "<strong>working</strong>" and "<strong>production-ready</strong>" are genuinely different bars, and most teams never write down what the second one actually means.</p>
<p>Let's be honest, AI can help you implement most of what's in this post. What it can't do is tell you what order it matters in, or which gaps will hurt you first at 3am. That's the judgment this post is for.</p>
<p>This post is a concrete baseline of what every service needs before it earns the right to take production traffic — regardless of language, framework, or what it does. Sections are ordered by priority — the first four are non-negotiable before go-live, the last two are critical but can follow shortly after.</p>
<hr />
<h2>1. Observability: You Can't Fix What You Can't See</h2>
<p>Observability is generally built on three pillars: logs, metrics, and traces <em>(Charity Majors (CTO of Honeycomb) considers this traditional "three pillars" model to be outdated and destructive, but let's save that for another post)</em>.</p>
<h3>Structured Logging</h3>
<p><strong>Logs</strong> tell you what happened and when, giving you the full event detail you need to understand a specific failure. But to make it context rich, every log line should be machine-readable JSON with a consistent schema. At minimum:</p>
<pre><code class="language-json">{
  "timestamp": "2025-01-15T09:23:11Z",
  "level": "error",
  "service": "payment-service",
  "trace_id": "abc123",
  "span_id": "def456",
  "event": "charge_failed",
  "reason": "upstream_timeout",
  "duration_ms": 3041
}
</code></pre>
<p>Log at meaningful boundaries: request ingress, egress, external call completions, and every handled error or fallback. The rule of thumb: if an on-call engineer would want to know it happened, log it.</p>
<p>Avoid freeform strings. <code>"something went wrong with the payment"</code> is useless under pressure. <code>"charge_failed"</code> with structured context is searchable, alertable, and aggregatable.</p>
<h3>Metrics: The Four Golden Signals</h3>
<p><strong>Metrics</strong> tell you the shape of your system over time: trends, thresholds, and anomalies at a glance. A metric spike tells you <em>something is wrong.</em></p>
<p>Track these four for every service, per endpoint:</p>
<table>
<thead>
<tr>
<th>Signal</th>
<th>What it tells you</th>
</tr>
</thead>
<tbody><tr>
<td><strong>Latency</strong></td>
<td>How long requests take (p50, p95, p99 — not just average)</td>
</tr>
<tr>
<td><strong>Error Rate</strong></td>
<td>% of requests returning errors</td>
</tr>
<tr>
<td><strong>Traffic</strong></td>
<td>Request volume (requests/sec)</td>
</tr>
<tr>
<td><strong>Saturation</strong></td>
<td>How close you are to capacity (CPU, memory, connection pools)</td>
</tr>
</tbody></table>
<p>Average latency lies. A p99 of 4000ms hidden inside a p50 of 80ms means 1 in 100 users is having a terrible experience. Always track percentiles.</p>
<h3>Distributed Tracing</h3>
<p><strong>Traces</strong> tell you where time was spent across a request's journey through your system.</p>
<p>If your service calls anything - a database, a cache, another service - instrument distributed tracing with W3C <code>traceparent</code> header (widely used example) propagation. Each external call becomes a child span. When latency spikes, you open one trace and immediately see which call is the culprit instead of correlating logs across three systems.</p>
<p>This is the single observability investment with the highest on-call ROI.</p>
<hr />
<h2>2. Alerting: Pages Should Mean Something</h2>
<p>The most common alerting failure is alerting on the wrong thing, e.g. raw error counts, CPU thresholds, or anything that fires so frequently it gets tuned out.</p>
<p><strong>Alert on SLO burn rates, not raw metrics.</strong></p>
<p>Define a Service Level Objective (e.g., 99.5% of requests succeed within 500ms over a 30-day window) that reflects what actually matters to your customers — not an arbitrary 99.99% because it sounds right. It should <strong>not</strong> alert you even if your service is completely down while no real customers are hitting it.</p>
<p>Then alert on how fast you're consuming that error budget:</p>
<ul>
<li><p><strong>Fast burn</strong> (e.g., burning 5% of your monthly budget in an hour) → page immediately</p>
</li>
<li><p><strong>Slow burn</strong> (e.g., elevated error rate that will breach SLO in 3 days) → create a ticket</p>
</li>
</ul>
<p>This approach means every page represents a genuine threat to your SLO. Engineers stop ignoring alerts. On-call becomes survivable.</p>
<p><strong>Every alert must link to a runbook.</strong> The runbook answers exactly:</p>
<ol>
<li><p>How do I confirm what's actually broken?</p>
</li>
<li><p>How do I mitigate it right now?</p>
</li>
<li><p>Who do I escalate to if I can't?</p>
</li>
</ol>
<p>If your runbook doesn't answer those three, it's not a runbook — it's a note to yourself.</p>
<hr />
<h2>3. Security: Least Privilege by Default</h2>
<p><strong>Scoped credentials</strong>: each service authenticates to each dependency with dedicated credentials, not a shared master key.</p>
<p><strong>Input validation</strong>: validate and sanitize all inputs at your service boundary before they touch any downstream system.</p>
<p><strong>PII in logs</strong>: if your service handles personal data, ensure it's redacted or excluded before reaching your log pipeline.</p>
<hr />
<h2>4. Deployment: Ship Safely, Roll Back Fast</h2>
<h3>Health Checks</h3>
<p>Expose at least two health check endpoints:</p>
<ul>
<li><p><strong>Process health</strong> → is the service running? (a <code>/health</code> returning 200 is enough)</p>
</li>
<li><p><strong>Dependency health</strong> → can the service actually reach what it needs? (checks DB connectivity, cache reachability, critical upstream availability)</p>
</li>
</ul>
<p>The distinction matters. A service that's running but can't reach its database should not receive traffic. Most health check implementations only cover the first case, which means your load balancer happily routes traffic to a service that will fail every request.</p>
<p>Whether you're behind a load balancer, a service mesh, or a reverse proxy, wire the dependency health check into whatever controls traffic routing.</p>
<h3>Progressive Rollouts</h3>
<p>Deploy via canary or blue/green. Tie automated rollback to your service's error rate, not just infrastructure health. A deployment that introduces a logic bug will look perfectly healthy to CPU and memory monitors while users are getting errors.</p>
<h3>Disaster Recovery</h3>
<p>Incidents will happen. The question is whether your team has a documented, tested recovery plan before they do. Know how to redeploy your service from scratch, where your backups are, and what the recovery sequence looks like. If your DR process has never been rehearsed, it doesn't exist.</p>
<h3>5. Gatekeeper Testing</h3>
<p>Without automated baseline validation on Day 1, the deployment strategy is just guessing. Before a service takes production traffic, it must pass two gates:</p>
<ul>
<li><p><strong>Core Unit Tests:</strong> You don't need a vanity metric like 100% total coverage, but you must have total coverage over core business logic, state transitions, and critical risk areas (like financial mutations or data transformations).</p>
</li>
<li><p><strong>Smoke Tests:</strong> A lightweight post-deployment suite that executes in the environment immediately after a build drops, confirming network line-of-sight and basic handshakes with every integrated dependency.</p>
</li>
<li><p><strong>Integration Tests</strong>: Test the full flow end-to-end in a realistic environment.</p>
</li>
</ul>
<hr />
<p><em>The above five are your go-live gates: if any are missing, you're not ready for production traffic. The following two are equally critical to long-term stability, but can realistically follow in the sprint after launch.</em></p>
<hr />
<h2>6. Resilience: Assume the Network Will Lie to You</h2>
<h3>Timeouts</h3>
<p>Every external call needs an explicit timeout. Never rely on library or upstream defaults — they are almost always too long. Set timeouts based on your p99 baseline for that call, not on optimism.</p>
<p>A call that hangs indefinitely doesn't just affect that request. It ties up a thread or connection, which accumulates, which eventually exhausts your pool and takes down requests that have nothing to do with the slow dependency.</p>
<h3>Retries with Jitter</h3>
<p>Retries are only safe on idempotent operations. When you do retry, use exponential backoff with randomized jitter:</p>
<pre><code class="language-plaintext">wait = base_delay * 2^attempt + random(0, max_jitter)
</code></pre>
<p>Without jitter, every instance of your service retries in lockstep — creating a synchronized spike that hits the recovering upstream all at once. Imagine your upstream just recovered from a crash and 50 instances of your service all retry at exactly the same moment. That wall of traffic can knock it back down before it stabilises. Jitter staggers the retries across time so the upstream sees a trickle instead.</p>
<h3>Fallback Strategies</h3>
<p>For every external dependency, decide explicitly: what happens when it's unavailable? Options include serving stale cached data, returning a degraded response with a flag, or failing the request entirely.</p>
<p>The worst answer is implicit behavior. Undefined fallbacks mean your service does something unpredictable under failure — which is the hardest kind of incident to debug at 3am.</p>
<hr />
<h2>7. Advanced Validation: Breaking the System to Prove It Scale</h2>
<h3>Load Tests &amp; Resource Sizing</h3>
<p>These only tell you something useful once you have a baseline: known peak traffic, a throughput SLA, or prior benchmark data. Without that, you're running numbers against a vacuum.</p>
<p>Once you have a baseline, load test against it and size your resources accordingly: connection pool limits, memory headroom for request buffering, thread counts, and horizontal scaling triggers. The common mistake is sizing for average traffic. Size for your realistic peak with headroom, and define your scaling trigger before you need it, not during an incident.</p>
<hr />
<h2>Self-Assessment</h2>
<p><strong>Go-live gates — all must be yes before shipping:</strong></p>
<ul>
<li><p>[ ] Are logs structured JSON with consistent <code>trace_id</code> and <code>span_id</code>?</p>
</li>
<li><p>[ ] Are you tracking p95 and p99 latency, not just averages?</p>
</li>
<li><p>[ ] Are you alerting on SLO burn rates, not raw error counts?</p>
</li>
<li><p>[ ] Does every alert link to a runbook with a mitigation step?</p>
</li>
<li><p>[ ] Is PII excluded from logs by design?</p>
</li>
<li><p>[ ] Are service credentials scoped per dependency?</p>
</li>
<li><p>[ ] Does your dependency health check gate traffic routing?</p>
</li>
<li><p>[ ] Can you roll back within 5 minutes if error rates spike post-deploy?</p>
</li>
<li><p>[ ] Has your disaster recovery plan been rehearsed, not just documented?</p>
</li>
<li><p>[ ] Do smoke tests run automatically after every deployment?</p>
</li>
</ul>
<p><strong>Ship these sprint two:</strong></p>
<ul>
<li><p>[ ] Does every external call have an explicit timeout?</p>
</li>
<li><p>[ ] Do retries use exponential backoff with jitter?</p>
</li>
<li><p>[ ] Is every fallback behavior explicitly defined?</p>
</li>
<li><p>[ ] Have you load tested against a realistic traffic baseline?</p>
</li>
<li><p>[ ] Have you verified resilience patterns trigger under chaos conditions?</p>
</li>
</ul>
<p>Hopefully, this baseline helps shape a clear roadmap for your next service launch and saves your team from that next 3am page.</p>
]]></content:encoded></item></channel></rss>