Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

48.3 KB
Raw Blame

Image fetcher implementation notes

The README is the normative specification. This file records the implementation, assumptions, and rollout constraints.

Implementation map

URL collection and identity

The shared Rust URL policy performs admission, canonicalization, and global ref creation. It refuses private targets, credentials, userinfo, known signed URLs, and the beacons listed in tracking_beacons.txt. The anonymizer also refuses an img that is hidden or at most one pixel before the URL reaches the policy, in both the tree walk and the byte walk. The policy marks a beacon as unwanted rather than invalid. The fetcher reads that mark through the addon and skips an unwanted job on its own, because a rejected job would send its whole record to the dead-letter topic. The list is compiled into both lanes, so a list change ships only with an image build of the mirror and the fetcher.

The mirror emits versioned frontier jobs. Each job carries the original ref, current URL, remaining hops, timing, and amplification counters.

The mirror can read crawl history after its local URL cache and before Kafka. It suppresses URLs whose next fetch time is still in the future. A timeout or store error publishes every candidate. The fetch consumer repeats the read because a completion can race with the mirror.

Kafka uses the registrable domain as the frontier key. Token-bucket rate and burst settings use that key when enabled. Active-request, transient back-off, and circuit-breaker state also use that key. Policy caches and crawl delay use the full origin.

Policy and network boundary

The fetcher evaluates robots.txt, TDMRep, response opt-outs, and HTTP cache metadata. Configuration misses are coalesced per origin and file.

The fetcher follows configuration redirects only inside the source registrable domain. It treats a cross-registrable-domain redirect as unreachable.

The shared streamed-request helper preserves repeated response field lines. Policy evaluation therefore sees every opt-out field in received order.

Image and configuration requests opt into HTTP/2 on the shared secure dispatcher. Requests to an origin reuse its session instead of opening a new TLS connection each time, which saves a handshake on both sides. The dispatcher decides how many sessions an origin gets and when an idle one closes. An origin that offers only HTTP/1.1 gets HTTP/1.1 with no change in behavior.

Production requests use Smokescreen. The Rust admission policy also refuses every IP literal, including a public IP literal.

Web Bot Auth uses the shared PostHog key directory. The directory response has a 60-second public cache lifetime.

Scheduling and retries

Each registrable domain has an optional token bucket, an active-request limit, a transient-failure count, and a circuit breaker. Each origin has its own crawl delay and configuration-request state. Each runtime map contains at most 20,000 entries. The default disables the token bucket. The default allows 6 active requests. An explicit robots.txt crawl delay still spaces requests to its origin.

A registrable domain remains in memory while it is active, blocked, or has a pending request grant. An origin remains in memory while it has an active or scheduled request, a reserved image-request start, or an unelapsed crawl delay. A full map defers untracked work without network access.

The fetch pass deduplicates jobs by global canonical ref. It groups the remaining jobs by registrable domain and origin. Two indexed priority queues select work in logarithmic time. Each queue gets a capped proportional concurrency target. The scheduler selects the queue that is furthest below its target. It uses the waiting job count and insertion order as tie-breakers.

The queue tracks the remaining request slots from active and waiting jobs. It applies the configured registrable-domain and pod limits. A job releases its registrable-domain slot when the image response is complete. It keeps its pod slot until Kafka acknowledges the image publish. The worker then starts the next job while the publish continues. When fewer than 48 slots remain, low-diversity mode can start. More than 50 waiting URL jobs must still be eligible for a diversity deferral. The pass processes 8 more jobs. It then republishes each eligible tail job to the frontier. The mode stays active for the rest of the pass. A durable optional marker limits this fast deferral to once per job. Previously deferred jobs proceed normally until the pass deadline.

The frontier consumer uses cooperative rebalancing. Its revoke path drains active work before it releases assigned partitions.

Each image-fetch worker creates two Kafka group members by default. A local joiner combines their batches before it starts a fetch pass. When SESSION_RECORDING_ML_IMAGE_FETCH_JOIN_MEMBER_BATCHES is false, each member batch starts its own pass immediately, so a slow partition does not hold back the other members. Group assignments do not overlap, and each member can own multiple partitions. The joiner processes available batches when its join window ends. Each member waits for its group to start before it reads another batch, so a group has at most one contribution per member. The member then tracks completion through the shared Kafka consumer background-task mechanism. Each member can hold two unfinished batches. The consumer waits for the oldest batch at that limit and stores offsets in batch order. Shared request limits still bound total network concurrency. The background-task timeout is 240 seconds, leaving 60 seconds below the default Kafka poll allowance for joining and scheduling. Shutdown stops all consumer loops and waits for the actual joined processing promises before disconnecting consumers and destroying shared dependencies. This wait includes work that outlives the Kafka consumer drain or background-task timeout. The worker divides a 100 MiB Kafka prefetch budget across its group members, with a minimum of 25 MiB per member. This preserves the queue sizes for one to four members and allows a default maximum-sized record in each queue. Sixteen members have a combined prefetch budget of 400 MiB. During a mixed-version rollout, pods with more group members can receive more partitions until the rollout finishes. SESSION_RECORDING_ML_IMAGE_FETCH_TARGET_PARTITIONS_PER_BATCH accepts targets from one to sixteen for worker-count experiments.

SESSION_RECORDING_ML_IMAGE_FETCH_CONTINUOUS_POOL replaces the joiner with one candidate pool for the worker (fetch-candidate-pool.ts). A batch no longer waits for the slowest job of another member's batch. The pool counts registrable-domain and origin slots across the worker, so two batches from one partition cannot each claim a domain's full limit. The fetch pass counts those slots per pass, and the request scheduler then refuses the excess as connection_limit. The fetch workers start with the first batch and take jobs among eligible origins in the order the jobs entered the pool. Inside one batch, jobs enter the pool in capture order, so a deferred job is not held behind later captures of its domain on every pass. The pool holds an origin with a crawl delay until the delay passes, so a job does not hold a pod request slot while it waits. Each member returns from its batch handler only when its pool window has room (pool-window-batch-handler.ts), and it can hold four unfinished batches, which is the hard bound on its resident jobs. A fetch worker that finds no eligible job gives room to every member under the queued-job limit, because jobs that count as runnable can still wait on a crawl delay or on another member's hold on a domain. The room wait stops after 30 seconds, below the consumer's 60-second stalled-loop check, so the queued-job limit can be passed by about one batch. Crawl-history reads and writes and republish flushes stay per batch. Shutdown waits for every member batch that has started, including one still reading crawl history before it reaches the pool, before it stops the fetch workers. A batch can outlive the Kafka consumer drain, and the pool refuses candidates once it is closed.

Retry jobs use 1-minute, 10-minute, and 1-hour Kafka topics. The topics use broker append timestamps.

Each delay consumer waits once for the latest record in its batch. It then republishes the complete batch to the frontier.

The fetch consumer buffers republished jobs until the fetch pass ends. It groups them by destination topic and current registrable domain, then packs each group to the shared job-count and byte limits. Redirects and pass-deadline deferrals return to the frontier. Work with a positive required wait uses a delay topic. Kafka deliveries use the configured pending-publish limit. One failed delivery stops the batch from starting more records, which bounds partial-delivery amplification before the source offsets retry. A monotonic deadline stops new deliveries 200 seconds after the poll batch starts. The producer's 20-second message timeout and the crawl-history store's 50-second batch budget plus command timeout keep the worst-case finalization near 275 seconds, below Kafka's 300-second poll limit.

One source-domain record can redirect to several target registrable domains. Such a batch can publish more frontier records than it consumed. The lane keeps each target domain as a separate Kafka key instead of delaying a zero-wait redirect.

Durable completion

DynamoDB stores URL outcomes and configuration entries. Reads use 100-item batches and writes use 25-item batches. Large configuration bodies use immutable generation-specific chunks that publish before their manifest.

The client retries unprocessed keys and items with bounded concurrency and time. It retries a batch command that reaches the command timeout in the same way, because a batch get or batch write of the same items is idempotent. An incomplete chunk generation is a logged cache miss that the next configuration fetch repairs. A malformed base item fails the Kafka batch.

For a successful fetch, the producer publishes the image before DynamoDB records completion. Kafka offsets commit only after both operations succeed.

Frontier records retain work until a terminal result. A pass deadline defers unfinished jobs instead of dropping them.

Fetch-to-scrub transport

The fetch producer sends the encoded response body as the Kafka value. Headers carry the content type and ordered content codings.

The production fetch queue can hold one full 100-record batch at the response-size limit. The delay consumers publish sequentially to avoid queue-full replay loops.

The scrubber decodes supported codings in reverse order. It enforces the uncompressed limit during each decoding layer and verifies the image signature.

Inline images retain sharded storage and Parquet indexes. URL images use scrubbed-images/url/<global-hash> for deterministic direct lookup. Conditional creates keep the first scrubbed image written for each global ref.

URL-image S3 writes use the scrub worker concurrency bound. A full scrub batch cannot create an unbounded S3 request burst.

The ML data-preparation resolver reads URL images by global ref. It removes sibling ref attributes before rendering, including when an image is absent.

Operations

Metrics cover terminal outcomes, requests, origin policy, registrable-domain request state, retries, amplification, system time, and DynamoDB failures. Mirror metrics separate fresh history, misses, errors, and read duration. Every metric label defined by this lane uses a fixed category.

Batch-diversity histograms record the top 1, 5, and 10 URL shares and the inverse Simpson effective count for origins and registrable domains. Fetch-pass histograms record immediately schedulable slots and their ratio to the pod request limit. These metrics use only fixed scope and top-count labels.

ml_image_fetch_republished_total keeps the topic label key for rolling compatibility. The only values emitted by the new code are frontier and delay.

Republish batch metrics use the fixed topic classes frontier, retry_1m, retry_10m, and retry_1h. They expose Kafka record count, registrable-domain key count, per-topic delivery time, and total republish flush time. They do not use a configured topic name or a domain as a label.

Processing-stage metrics expose the active count, oldest active age, and elapsed time of finished operations, including failures. Consumer stages separate the join window from waiting for the combined batch to finish. Their active counts measure outstanding consumer batches, not distinct consumers; overlap can raise the processing count to twice the member count. Compare p95 and p99 for image HTTP, configuration HTTP, candidate work, and batch fetch duration separately. Check the oldest active stage age too, because completed-duration histograms exclude unfinished work. Evaluate tighter request timeouts against successful fetch throughput, timeout failures, and deadline republishes. Batch stages separate parsing, history reads, filtering, fetching, republish preparation, history writes, republish flushes, final accounting, and dead-letter delivery. Candidate stages separate admission to the pod-wide controller, work that holds a slot, policy checks, and image fetching. The queued-candidate gauge counts work before selection; it excludes candidates waiting for admission or already running. Request stages distinguish configuration and image HTTP work from capacity, crawl-delay, and domain-rate waits. Image publication separates admission from Kafka delivery. Stage timers use a monotonic clock and record actual elapsed time, including scheduler delays. Nested stages overlap: candidate work includes policy and publication, and candidate fetch includes scheduler waits and redirect policy checks. Do not sum nested stages or subtract their percentiles to estimate batch time.

Configuration lookup counters distinguish cached results, callers that share an existing request, and callers that start a new request. Their outcome describes the cache entry or fetched result before any stale-cache fallback. Configuration fetch counters count each redirect chain once, with a fixed failure category. A timeout category means the request deadline elapsed before an exception reached the fetcher; other exceptions use request_error. These counters do not count individual redirect hops, and shared or cached results can produce multiple policy decisions. No new metric uses a URL, hostname, domain, error message, or batch identifier as a label.

The Grafana dashboard uses these runtime metrics. Its frontier health panels exclude the delay topics so they do not double-count retry traffic.

The Helm deployment defines fetch, scrub, and three retry consumers. Fetch and retry synchronization remains manual until their dependencies exist.

The optional fetch dead-letter topic stores each rejected frontier record with its original key and value. It adds bounded headers for the reason, schema version class, source topic, partition, and offset. The value can contain an original URL, so this topic has the same sensitivity as the frontier. The consumer waits for every dead-letter acknowledgement before it can commit the source offset. It publishes with bounded concurrency and a 50-second batch budget after other batch work succeeds. A failed publish fails the source batch. A retry can duplicate records that reached the dead-letter topic before another dead-letter publish failed. Operators can identify those duplicates by source topic, partition, and offset. The lane has no automatic dead-letter replay.

Failure-mode observability

The lane uses bounded labels for all signals. The dashboards group failures by a fixed operation, reason, outcome, stage, or destination.

Failure mode Primary signal Dashboard or alert Response
The 40-second pass budget is too short. ml_image_fetch_republished_total{reason="pass_deadline"} divided by completed URLs plus all republishes Fetch dashboard: Pass deadline deferral rate. Check the completion age first. A high share is expected when a registrable domain has more queued URLs than its concurrency limit can serve in one pass. One pod owns each registrable domain, so more pods do not drain that domain faster. Increase the pass budget only if active batch age keeps enough margin below Kafka's 300-second poll limit.
A fetch batch approaches Kafka's 300-second poll limit. Active batch age exceeds 180 seconds. Completed batch duration shows the recent distribution. Fetch dashboard: Poll batch duration. Alert: IngestionSessionReplayImageFetchBatchNearPollLimit. Check store latency and request scheduling. Scale the lane before changing the pass budget.
The fetch lane cannot drain its frontier topic. The frontier backlog exceeds 30 minutes of input, and a one-hour projection stays above that limit. The backlog is the lag divided by the input rate of the topic. Fetch dashboard: Kafka lag and drain time. Alert: IngestionSessionReplayMlConsumerNotDraining, which covers all four ML replay lanes. Check consumer members, pod capacity, request waits, and deadline deferrals.
The fetch consumer stops committing frontier offsets. The consumer commits no frontier offset for 30 minutes while the frontier has lag. This also detects a stall when the input stops. Alert: IngestionSessionReplayMlConsumerStalled, which covers all four ML replay lanes. Check consumer members, pod restarts, and the active batch age.
URLs reach a terminal outcome long after capture. More than 5% of the URLs that completed during the last hour were captured more than six hours before, for one hour. ml_image_fetch_completed_url_system_time_seconds gives the distribution. Fetch dashboard: URL age and completion time. Alert: IngestionSessionReplayImageFetchCompletionDelayed. Check frontier lag, consumer members, pod CPU throttling, and request outcomes.
DynamoDB is slow, or a DynamoDB or Kafka request fails. Crawl-history duration by operation and outcome, a store error, a republish failure, or a failed retry release. A durable consumer-loop error log covers a pod that exits before a metrics scrape. Fetch dashboard: Store health and delivery failures. Loki alert: IngestionSessionReplayImageFetchConsumerLoopFailed. Check the failed or slow operation. Do not discard or manually commit the affected offsets.
Kafka republishing consumes a large part of the poll interval. Total republish flush duration and per-topic delivery time increase. Records and registrable-domain keys per topic show whether the cause is volume, redirect fan-out, or delivery latency. A finalization-deadline counter records batches that stop before all records start. Fetch dashboard: Republish messages and registrable domains per batch, Republish batch duration, Store health and delivery failures, and Poll batch duration. Check Kafka producer latency and target-domain fan-out. Keep the active batch below Kafka's poll limit.
The fetch lane is alive but the input is empty. Polls increase, consumer members remain present, and batch utilization is zero. Fetch dashboard: lane liveness and poll batch utilization. Check the version 2 mirror producer and the input-topic production rate.
Poll batches contain few distinct origins or registrable domains, or the pod reaches request capacity. Distinct counts, top 1, 5, and 10 URL shares, effective counts, immediately schedulable slots, scheduler waits, requests in flight, deadline deferrals, and not_ready republishes. Fetch dashboard: batch diversity, request capacity, scheduler waits, origin policy, registrable-domain state, request outcomes, and republishes. Increase batch size only when low diversity coincides with low request use, scoped scheduler wait, and sufficient Kafka poll margin. Scale pods for pod saturation.
One frontier partition accumulates lag. Per-partition input, fetchable, HTTP request, completion, republish, scheduler-wait, top-share, and effective-count metrics. Fetch dashboard: partition flow, outcomes, scheduler waits, and concentration. Separate high input volume from store filtering, HTTP work, politeness waits, and republish churn before changing capacity.
A registrable domain repeatedly fails, or an origin refuses access. Request outcomes, bounded retry causes, registrable-domain block state, origin-policy decisions, and terminal refusal reasons change. Fetch dashboard: request outcomes, retry causes, policy and budget decisions, and refused URLs. Check the origin policy and response status. Do not override an opt-out signal.
Retry release cannot return work to the frontier. ml_image_fetch_retry_released_total{outcome="failed"} and a durable consumer-loop error log. Fetch dashboard: delivery failures. Loki alert: IngestionSessionReplayImageFetchConsumerLoopFailed. Check the frontier producer and Kafka connectivity.
Retry input is invalid. ml_image_fetch_retry_released_total increases with a malformed or invalid_timestamp outcome. Missing content is committed and dropped. An invalid timestamp leaves the offset uncommitted and writes a durable consumer-loop error log. Fetch dashboard: delivery failures. Alerts: IngestionSessionReplayImageFetchRetryInputRejected for missing content and IngestionSessionReplayImageFetchConsumerLoopFailed for an invalid timestamp. Check the retry producer and the delay topic's LogAppendTime configuration.
The fetch consumer rejects frontier input. ml_image_fetch_consumer_dead_lettered_total increases after Kafka acknowledges the original record. ml_image_fetch_consumer_dropped_total counts the rejected jobs. Fetch dashboard: quarantine activity and URLs refused. Alert: IngestionSessionReplayImageFetchInputRejected for a sustained rate. Check the mirror and fetch versions and the frontier record schema. Inspect the restricted dead-letter topic only when necessary.
The fetch consumer skips unwanted frontier jobs. ml_image_fetch_consumer_skipped_total increases by decline reason. After a beacon-list change it rises at the backlog's parse rate until the queued beacons drain. ml_image_fetch_consumer_dropped_total does not move. Fetch dashboard: Unwanted URLs skipped and Skipped share of parsed URLs. No action. A skipped job is counted after the batch finishes its durable work, so a failed batch is not counted twice. A crash before the offset store can count it once more, like every counter in this consumer.
The fetch consumer cannot quarantine rejected input. ml_image_fetch_consumer_dead_letter_failed_total increases and ml_image_fetch_dead_letter_publish_failed logs before the consumer fails the batch. The source offsets remain uncommitted. Fetch dashboard: quarantine activity. Alerts: IngestionSessionReplayImageFetchDeadLetterPublishFailed and the durable-log IngestionSessionReplayImageFetchConsumerLoopFailed. Check the dead-letter topic, producer connectivity, and message-size configuration.
A retry worker shuts down during a deliberate wait. ml_image_fetch_retry_released_total{outcome="abandoned"} increases. The consumer does not commit that offset. Fetch dashboard only. This expected shutdown outcome does not alert. Check pod lifecycle only if the rate does not match a rollout or scale-down.
The scrub sidecar is saturated or unreachable. Scrub waits increase by busy, timeout, refused, reset, or transport. Scrub dashboard: scrub waits and sidecar pressure. Alert: IngestionSessionReplayImageScrubSidecarUnreachable. Scale for busy. Check CPU for timeout. Check that the image-scrub container is running for refused. Expect reset on rollouts and scale-downs. Read the error text in the image_scrub_image_stuck log for transport.
The sidecar answers but cannot scrub. Scrub waits increase by rejected, stuck images rise, or ml_mirror_image_scrub_consumer_dead_lettered_total increases. Scrub dashboard: scrub waits and quarantine events. Check the image-scrub container logs for the failing stage. Fix the sidecar before Kafka retention removes the parked bytes.
The scrub consumer rejects input. ml_mirror_image_scrub_consumer_invalid_key_total increases. The consumer commits and drops the record. Scrub dashboard: invalid-key events. Alert: IngestionSessionReplayImageScrubInputRejected. Check the fetch and scrub versions, the content-ref format, and the scrub topic.
One image blocks later offsets. Stuck-image events increase, batch retired ratio falls, or batch duration approaches 300 seconds. Scrub dashboard: batch progress, batch duration, and quarantine events. Find the image ref in logs. Check if dead-letter publication succeeds.
Scrub output cannot reach S3 or the dead-letter topic. A write batch failure or dead-letter publication failure occurs. Durable error logs cover a pod that exits before a metrics scrape. Scrub dashboard: consumer delivery failures. Loki alerts: IngestionSessionReplayImageScrubConsumerLoopFailed and IngestionSessionReplayImageScrubDeadLetterPublishFailed. Check bucket access, topic configuration, and maximum Kafka message size.
A dead-letter replay cannot recover an image. The replay emits image_scrub_replay_exhausted. The process metric is also visible if a scrape catches the bounded replay run. Scrub dashboard: quarantine events. Loki alert: IngestionSessionReplayImageScrubReplayExhausted. Fix or accept the permanent sidecar refusal before Kafka retention removes the parked bytes.
A scrub batch approaches Kafka's 300-second poll limit. Active batch age exceeds 180 seconds. Completed batch duration shows the recent distribution. Scrub dashboard: Image and batch duration. Alert: IngestionSessionReplayImageScrubBatchNearPollLimit. Check the retired ratio, stuck images, waits, CPU, and memory.
Inline image scrub exceeds its delivery limit. The p95 capture-to-S3 latency for inline images exceeds one hour for 30 minutes. Scrub dashboard: end-to-end latency. Alert: IngestionSessionReplayImageScrubNotDraining. Check sidecar waits, CPU, memory, and consumer restarts.
URL image scrub exceeds its delivery limit. The p95 capture-to-S3 latency for URL images exceeds three days for 30 minutes. Fetch and scrub dashboards: frontier health and end-to-end latency. Alert: IngestionSessionReplayImageScrubNotDraining. Check the image-fetch frontier, retries, request outcomes, and sidecar waits.

The completion-age alert is inactive in dry-run mode. Delay-topic lag has no alert because queued delay records are expected. Generic Kubernetes alerts cover pod crash loops and unavailable replicas.

Assumptions

  • Image source selection follows requirements 13.11–13.12. A usable img[srcset] suppresses that element's src and rr_src fallbacks. Shopify resize normalisation follows the shared URL policy.
  • A response can contain at most four content-coding layers. This bound limits decompression work while retaining common stacked encodings.
  • The standard pass is shorter than the minimum image retry delay. Active back-off therefore follows requirement 7.13 without an in-memory second pass.
  • Smokescreen is the authoritative production DNS and connection boundary. Local URL admission is an additional fail-closed check.
  • The fetch deployment uses Smokescreen without proxy credentials. The lane does not send Proxy-Authorization.
  • The Web Bot Auth private key and Kubernetes secret remain operator-managed. No private key material belongs in these repositories.
  • The DynamoDB table and its workload identity permissions exist before the fetch deployment becomes active.
  • The mirror workload has DynamoDB read permission before deployment.
  • The shared ML bucket grants the data-preparation workload read access to the deterministic URL-image prefix.
  • Retry topics use the ai_research_session_replay_ naming convention.
  • Replacement infrastructure provisions the required topics before consumers start. No deployed producer or consumer uses the deprecated names.
  • Deprecated topics remain protected and unused. Their cleanup is not required for this rollout.
  • Current public documentation already describes the collector-side image limits. No separate documentation repository change is required.
  • A cross-registrable-domain configuration redirect fails closed. This rule prevents a source Kafka partition from creating request state for another partition's registrable domain.
  • Deduplication uses the global canonical ref. Redirect targets keep separate original refs because their terminal results must complete the replay URLs that created those refs.
  • The parser accepts and removes the legacy diversity-deferral marker so that existing topic records drain during a rolling deployment.

Delta from the original requirements

The implementation has four product-behavior or interface deltas from the original requirements.

Original requirement Final implementation Reason and effect
Accept any number of supported content-coding layers. Accept at most four layers. This bound limits decompression work. A response with more than four layers is refused. Requirements 14.1 and 17.6 now state this bound.
Export top-N registrable and provider domains and exact HTTP response values. Export no registrable-domain or provider-domain labels and group HTTP status by class. The metrics system does not support high-cardinality labels. Fixed categories keep the number of time series bounded. Per-registrable-domain request share is not available in metrics. Requirements 11.2 and 11.6 now state this rule.
Apply one crawl delay across a registrable domain. Apply each crawl delay only to the origin that published it. robots.txt answers for one origin. Sibling origins still share any enabled rate and burst, plus active-request, transient back-off, and circuit-breaker controls. Requirements 5.11, 5.12, 7.10, and 7.11 state the split.
Follow a configuration redirect to any authority without Kafka republishing. Follow it only inside the source registrable domain. Cross-registrable-domain redirects could create a second pod-local budget outside the target Kafka owner. The lane treats the source configuration as unreachable and does not request the target. Requirements 3.5 and 5.4 state this bound.

The implementation also has these rollout and repository-state deltas. They do not change steady-state fetch behavior.

  • The 40-second pass and its 50-second worst-case wall time are shorter than the first retry delay. Therefore, retries use the durable delay topic and do not use an in-memory second pass.
  • Fetch and retry ApplicationSet synchronization stays manual until the cross-repository dependencies are active.
  • The base charts change keeps SESSION_RECORDING_ML_IMAGE_FETCH_DRY_RUN set to true and SESSION_RECORDING_ML_URL_PRODUCER_ENABLED set to false.
  • The first activation charts change clears fetch dry-run only after every consumer and infrastructure dependency is active.
  • The second activation charts change enables the version 2 mirror producer after active fetching is verified.
  • Web Bot Auth private keys and the Kubernetes secret stay outside source control. An operator must create them before activation.
  • The DynamoDB table and workload identity permissions were already present on the current infrastructure main branch. This work does not create a duplicate table or duplicate permissions.
  • The required public documentation was already present on the current posthog.com master branch. This work does not create an empty documentation pull request.

Deployment order

The Node.js image with grouped, bounded republish delivery must be active before the chart raises the poll batch to 50 records and the request budget to 40 seconds. The older per-URL publisher can spend too much of Kafka's poll interval finalizing the larger batch.

  1. Apply the Kafka topic sizes and broker timestamp settings from posthog-cloud-infra, including the image-fetch dead-letter topic.
  2. Apply the DynamoDB table, workload permissions, Smokescreen, and required secrets.
  3. Deploy the scrubber changes and the ML data-preparation resolver.
  4. Deploy the fetch and retry workloads with automatic synchronization disabled. Keep fetch dry-run enabled and the version 2 mirror producer disabled.
  5. Start each retry tier, then start the fetch workload and verify policy, refusal, origin-state, and registrable-domain-state metrics.
  6. Apply the first activation charts change to enable image publishing, then verify fetch processing and downstream delivery.
  7. Apply the second activation charts change to enable the version 2 mirror producer.
  8. Enable automatic synchronization after the first production verification succeeds.

Do not activate a delay consumer before its topic uses LogAppendTime. Producer timestamps do not provide the required delay guarantee.