: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(ingestion): clean up ingestion overflow config (#68715)
Paweł Ledwoń703d3828095e
diff --git a/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.test.ts b/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.test.tsindex 86e75f5f0ec0..2198c477b3d4 100644--- a/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.test.ts+++ b/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.test.ts@@ -32,7 +32,6 @@ describe('MainLaneOverflowRedirect', () => {localCacheTTLSeconds: 60,bucketCapacity: 10,replenishRate: 1,- statefulEnabled: true,overflowType: 'events',...overrides,})diff --git a/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.ts b/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.tsindex 7e90d57d7336..f5c48a75ff6f 100644--- a/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.ts+++ b/nodejs/src/ingestion/common/overflow-redirect/main-lane-overflow-redirect.ts@@ -1,3 +1,5 @@+import { LRUCache } from 'lru-cache'+import { MemoryRateLimiter } from '~/ingestion/common/overflow-redirect/overflow-detector'import { Component } from '~/ingestion/common/scopes'import { HealthCheckResult } from '~/types'@@ -15,18 +17,18 @@ import { OverflowRedisRepository, OverflowType, memberKey } from './overflow-redexport interface MainLaneOverflowRedirectConfig {redisRepository: OverflowRedisRepository- statefulEnabled: booleanlocalCacheTTLSeconds: number+ /** Max entries in the in-memory flagged/not-flagged cache before LRU eviction. */+ localCacheMaxSize?: numberbucketCapacity: numberreplenishRate: number/** Redis keyspace this service operates on. Fixed per pipeline. */overflowType: OverflowType}-interface CacheEntry {- value: boolean | null // true = flagged, null = known not in Redis- expiresAt: number-}+// Bounds the in-memory cache so a flood of unique token:distinct_id keys cannot+// grow it without limit; evicted keys simply re-check Redis on the next lookup.+const DEFAULT_LOCAL_CACHE_MAX_SIZE = 1_000_000/*** Main lane implementation of overflow redirect.@@ -41,19 +43,18 @@ interface CacheEntry {* Uses individual Redis keys with native TTL expiry (no ZSET).*/export class MainLaneOverflowRedirect implements OverflowRedirectService {- private localCache: Map<string, CacheEntry>+ private localCache: LRUCache<string, boolean>private rateLimiter: MemoryRateLimiter- private localCacheTTLSeconds: number- private statefulEnabled: booleanprivate redisRepository: OverflowRedisRepositoryprivate overflowType: OverflowTypeconstructor(config: MainLaneOverflowRedirectConfig) {this.redisRepository = config.redisRepository- this.localCache = new Map()+ this.localCache = new LRUCache({+ max: config.localCacheMaxSize ?? DEFAULT_LOCAL_CACHE_MAX_SIZE,+ ttl: config.localCacheTTLSeconds * 1000,+ })this.rateLimiter = new MemoryRateLimiter(config.bucketCapacity, config.replenishRate)- this.localCacheTTLSeconds = config.localCacheTTLSeconds- this.statefulEnabled = config.statefulEnabledthis.overflowType = config.overflowType}@@ -61,23 +62,14 @@ export class MainLaneOverflowRedirect implements OverflowRedirectService {return `${type}:${token}:${distinctId}`}- private getCachedValue(key: string): boolean | null | undefined {- const entry = this.localCache.get(key)- if (!entry) {- return undefined // cache miss- }- if (Date.now() > entry.expiresAt) {- this.localCache.delete(key)- return undefined // expired- }- return entry.value+ // true = flagged in Redis, false = known not in Redis, undefined = cache miss.+ // TTL expiry and size-bounded LRU eviction are handled by the cache itself.+ private getCachedValue(key: string): boolean | undefined {+ return this.localCache.get(key)}- private setCachedValue(key: string, value: boolean | null): void {- this.localCache.set(key, {- value,- expiresAt: Date.now() + this.localCacheTTLSeconds * 1000,- })+ private setCachedValue(key: string, value: boolean): void {+ this.localCache.set(key, value)}async handleEventBatch(batch: OverflowEventBatch[]): Promise<Set<string>> {@@ -86,62 +78,57 @@ export class MainLaneOverflowRedirect implements OverflowRedirectService {const redirectSource = new Map<string, 'redis' | 'rate_limiter'>()const needsRateLimitCheck: OverflowEventBatch[] = []- if (this.statefulEnabled) {- // Step 1: Check local cache (stateful only)- const needsRedisCheck: OverflowEventBatch[] = []+ // Step 1: Check local cache+ const needsRedisCheck: OverflowEventBatch[] = []++ for (const event of batch) {+ const cacheKey = this.localCacheKey(type, event.key.token, event.key.distinctId)+ const cached = this.getCachedValue(cacheKey)++ if (cached === true) {+ // Already flagged (cached from previous Redis lookup) - redirect+ const mKey = memberKey(event.key.token, event.key.distinctId)+ toRedirect.add(mKey)+ redirectSource.set(mKey, 'redis')+ overflowRedirectCacheHitsTotal.labels(type, 'hit_flagged').inc()+ } else if (cached === false) {+ // Known not in Redis - check rate limit only+ needsRateLimitCheck.push(event)+ overflowRedirectCacheHitsTotal.labels(type, 'hit_not_flagged').inc()+ } else {+ // Cache miss - need to check Redis+ needsRedisCheck.push(event)+ overflowRedirectCacheHitsTotal.labels(type, 'miss').inc()+ }+ }++ // Step 2: Batch check Redis for cache misses using MGET+ if (needsRedisCheck.length > 0) {+ const redisResults = await this.redisRepository.batchCheck(+ type,+ needsRedisCheck.map((e) => e.key)+ )- for (const event of batch) {+ for (const event of needsRedisCheck) {+ const mKey = memberKey(event.key.token, event.key.distinctId)const cacheKey = this.localCacheKey(type, event.key.token, event.key.distinctId)- const cached = this.getCachedValue(cacheKey)- if (cached === true) {- // Already flagged (cached from previous Redis lookup) - redirect- const mKey = memberKey(event.key.token, event.key.distinctId)+ if (redisResults.get(mKey)) {+ // Flagged in Redis - redirecttoRedirect.add(mKey)redirectSource.set(mKey, 'redis')- overflowRedirectCacheHitsTotal.labels(type, 'hit_flagged').inc()- } else if (cached === null) {- // Known not in Redis - check rate limit only- needsRateLimitCheck.push(event)- overflowRedirectCacheHitsTotal.labels(type, 'hit_not_flagged').inc()+ this.setCachedValue(cacheKey, true)} else {- // Cache miss - need to check Redis- needsRedisCheck.push(event)- overflowRedirectCacheHitsTotal.labels(type, 'miss').inc()- }- }-- // Step 2: Batch check Redis for cache misses using MGET (stateful only)- if (needsRedisCheck.length > 0) {- const redisResults = await this.redisRepository.batchCheck(- type,- needsRedisCheck.map((e) => e.key)- )-- for (const event of needsRedisCheck) {- const mKey = memberKey(event.key.token, event.key.distinctId)- const cacheKey = this.localCacheKey(type, event.key.token, event.key.distinctId)-- if (redisResults.get(mKey)) {- // Flagged in Redis - redirect- toRedirect.add(mKey)- redirectSource.set(mKey, 'redis')- this.setCachedValue(cacheKey, true)- } else {- // Not in Redis - cache null and check rate limit- this.setCachedValue(cacheKey, null)- needsRateLimitCheck.push(event)- }+ // Not in Redis - cache false and check rate limit+ this.setCachedValue(cacheKey, false)+ needsRateLimitCheck.push(event)}}-- // Update cache size metric- overflowRedirectCacheSize.set(this.localCache.size)- } else {- // Stateless: all events need rate limit check- needsRateLimitCheck.push(...batch)}+ // Update cache size metric+ overflowRedirectCacheSize.set(this.localCache.size)+// Step 3: Check rate limiter for unflagged keysconst newlyFlagged: OverflowEventBatch[] = []@@ -160,8 +147,8 @@ export class MainLaneOverflowRedirect implements OverflowRedirectService {}}- // Step 4: Batch flag newly rate-limited keys in Redis (stateful only)- if (this.statefulEnabled && newlyFlagged.length > 0) {+ // Step 4: Batch flag newly rate-limited keys in Redis+ if (newlyFlagged.length > 0) {// Update local cache BEFORE Redis write to prevent race condition where// a subsequent batch could check the rate limiter again before Redis completesfor (const event of newlyFlagged) {diff --git a/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.test.ts b/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.test.tsindex 077daa9d642d..1f2e426642af 100644--- a/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.test.ts+++ b/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.test.ts@@ -22,7 +22,7 @@ describe('createApplyEventRestrictionsStep', () => {routingConfig = {preservePartitionLocality: true,- overflowEnabled: true,+ overflowMode: 'redirect',}step = createApplyEventRestrictionsStep(eventIngestionRestrictionManager, routingConfig)@@ -310,7 +310,7 @@ describe('createApplyEventRestrictionsStep', () => {it('returns success when overflow is disabled', async () => {const disabledConfig: RoutingConfig = {...routingConfig,- overflowEnabled: false,+ overflowMode: 'disabled',}const disabledStep = createApplyEventRestrictionsStep(eventIngestionRestrictionManager, disabledConfig)diff --git a/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.ts b/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.tsindex 9f0b404416e9..423bf1976073 100644--- a/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.ts+++ b/nodejs/src/ingestion/common/steps/event-preprocessing/apply-event-restrictions.ts@@ -2,6 +2,7 @@ import { Counter } from 'prom-client'import { OVERFLOW_OUTPUT, OverflowOutput } from '~/common/outputs'import { EventIngestionRestrictionManager, RestrictionType } from '~/common/utils/event-ingestion-restrictions'+import { IngestionOverflowMode } from '~/ingestion/config'import { dlq, drop, ok, redirect } from '~/ingestion/framework/results'import { ProcessingStep } from '~/ingestion/framework/steps'import { EventHeaders } from '~/types'@@ -12,7 +13,7 @@ export const ingestionOverflowingMessagesTotal = new Counter({})export type RoutingConfig = {- overflowEnabled: boolean+ overflowMode: IngestionOverflowModepreservePartitionLocality: boolean}@@ -66,7 +67,7 @@ export function createApplyEventRestrictionsStep<T extends { headers: EventHeade}// Priority 3: Overflow- if (routingConfig.overflowEnabled && restrictions.has(RestrictionType.FORCE_OVERFLOW)) {+ if (routingConfig.overflowMode === 'redirect' && restrictions.has(RestrictionType.FORCE_OVERFLOW)) {ingestionOverflowingMessagesTotal.inc()const shouldProcessPerson = !restrictions.has(RestrictionType.SKIP_PERSON_PROCESSING)const preservePartitionLocality = shouldProcessPerson ? true : routingConfig.preservePartitionLocalitydiff --git a/nodejs/src/ingestion/config.ts b/nodejs/src/ingestion/config.tsindex 43714d1bc022..fe74dab394d2 100644--- a/nodejs/src/ingestion/config.ts+++ b/nodejs/src/ingestion/config.ts@@ -89,8 +89,19 @@ export const DELAYED_INGESTION_LANES = ['historical', 'async'] as constexport type IngestionLane = (typeof REALTIME_INGESTION_LANES)[number] | (typeof DELAYED_INGESTION_LANES)[number]+/**+ * How a consumer participates in overflow handling. Explicit and independent of+ * the lane name:+ * - `redirect` redirect hot partitions to the overflow topic (main lane).+ * - `consume` drain the overflow topic and refresh its stateful TTLs (overflow lane).+ * - `disabled` no overflow handling.+ */+export const INGESTION_OVERFLOW_MODES = ['redirect', 'consume', 'disabled'] as const+export type IngestionOverflowMode = (typeof INGESTION_OVERFLOW_MODES)[number]+export type IngestionConsumerConfig = {INGESTION_LANE: IngestionLane | null+ INGESTION_OVERFLOW_MODE: IngestionOverflowMode// Kafka consumer configINGESTION_CONSUMER_GROUP_ID: string@@ -146,7 +157,6 @@ export type IngestionConsumerConfig = {EVENT_OVERFLOW_BUCKET_REPLENISH_RATE: number// Stateful overflow config- INGESTION_STATEFUL_OVERFLOW_ENABLED: booleanINGESTION_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS: numberINGESTION_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS: number@@ -210,6 +220,7 @@ export type IngestionConsumerConfig = {export function getDefaultIngestionConsumerConfig(): IngestionConsumerConfig {return {INGESTION_LANE: null,+ INGESTION_OVERFLOW_MODE: 'disabled',// Kafka consumer configINGESTION_CONSUMER_GROUP_ID: 'events-ingestion-consumer',@@ -258,7 +269,6 @@ export function getDefaultIngestionConsumerConfig(): IngestionConsumerConfig {EVENT_OVERFLOW_BUCKET_REPLENISH_RATE: 1.0,// Stateful overflow config- INGESTION_STATEFUL_OVERFLOW_ENABLED: false,INGESTION_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS: 300,INGESTION_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS: 60,diff --git a/nodejs/src/ingestion/ingestion-consumer.test.ts b/nodejs/src/ingestion/ingestion-consumer.test.tsindex cf25075a9f95..333f9f4a802e 100644--- a/nodejs/src/ingestion/ingestion-consumer.test.ts+++ b/nodejs/src/ingestion/ingestion-consumer.test.ts@@ -281,9 +281,13 @@ describe('IngestionConsumer', () => {describe('overflow', () => {const now = () => DateTime.now().toMillis()- beforeEach(() => {+ beforeEach(async () => {// Just to make it easy to see what is configuredexpect(infra.config.EVENT_OVERFLOW_BUCKET_CAPACITY).toEqual(1000)+ // Overflow is now gated on explicit mode; the main lane redirects.+ infra.config.INGESTION_OVERFLOW_MODE = 'redirect'+ await ingester.stop()+ ingester = await createIngestionConsumer(infra)})it('should emit to overflow if token and distinct_id are overflowed', async () => {@@ -308,7 +312,8 @@ describe('IngestionConsumer', () => {})it('does not overflow if it is consuming from the overflow topic', async () => {- // Create a new consumer that consumes from the overflow topic+ // Overflow lane consumes the overflow topic; it never redirects back.+ infra.config.INGESTION_OVERFLOW_MODE = 'consume'const overflowIngester = await createIngestionConsumer(infra, {INGESTION_CONSUMER_CONSUME_TOPIC: 'events_plugin_ingestion_overflow_test',})@@ -332,10 +337,9 @@ describe('IngestionConsumer', () => {describe('stateful overflow redirect', () => {it('refreshes Redis TTL when processing events in overflow lane', async () => {- // Enable stateful overflow- infra.config.INGESTION_STATEFUL_OVERFLOW_ENABLED = trueinfra.config.INGESTION_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS = 300infra.config.INGESTION_LANE = 'overflow'+ infra.config.INGESTION_OVERFLOW_MODE = 'consume'// Create overflow lane consumerconst overflowIngester = await createIngestionConsumer(infra, {@@ -376,10 +380,9 @@ describe('IngestionConsumer', () => {})it('does not create keys when refreshing TTL for non-existent keys', async () => {- // Enable stateful overflow- infra.config.INGESTION_STATEFUL_OVERFLOW_ENABLED = trueinfra.config.INGESTION_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS = 300infra.config.INGESTION_LANE = 'overflow'+ infra.config.INGESTION_OVERFLOW_MODE = 'consume'// Create overflow lane consumerconst overflowIngester = await createIngestionConsumer(infra, {diff --git a/nodejs/src/ingestion/ingestion-consumer.ts b/nodejs/src/ingestion/ingestion-consumer.tsindex f0602b80d8c9..7c012e5711f1 100644--- a/nodejs/src/ingestion/ingestion-consumer.ts+++ b/nodejs/src/ingestion/ingestion-consumer.ts@@ -177,20 +177,22 @@ export class IngestionConsumer {redisTTLSeconds: this.config.INGESTION_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS,})- // Create overflow redirect service only when overflow is enabled (main lane)- if (this.overflowEnabled()) {+ // Overflow role for this consumer (redirect / consume / disabled).+ const overflowMode = this.config.INGESTION_OVERFLOW_MODE++ // Redirect hot partitions to the overflow topic (main lane).+ if (overflowMode === 'redirect') {this.overflowRedirectService = new MainLaneOverflowRedirect({redisRepository: overflowRedisRepository,localCacheTTLSeconds: this.config.INGESTION_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS,bucketCapacity: this.config.EVENT_OVERFLOW_BUCKET_CAPACITY,replenishRate: this.config.EVENT_OVERFLOW_BUCKET_REPLENISH_RATE,- statefulEnabled: this.config.INGESTION_STATEFUL_OVERFLOW_ENABLED,overflowType: 'events',})}- // Create TTL refresh service when consuming from overflow topic (overflow lane)- if (this.config.INGESTION_LANE === 'overflow' && this.config.INGESTION_STATEFUL_OVERFLOW_ENABLED) {+ // Drain the overflow topic and refresh stateful TTLs (overflow lane).+ if (overflowMode === 'consume') {this.overflowLaneTTLRefreshService = new OverflowLaneOverflowRedirect({redisRepository: overflowRedisRepository,overflowType: 'events',@@ -267,7 +269,7 @@ export class IngestionConsumer {const joinedPipelineConfig: JoinedIngestionPipelineConfig = {eventSchemaEnforcementEnabled: this.config.EVENT_SCHEMA_ENFORCEMENT_ENABLED,- overflowEnabled: this.overflowEnabled(),+ overflowMode: this.config.INGESTION_OVERFLOW_MODE,preservePartitionLocality: this.config.INGESTION_OVERFLOW_PRESERVE_PARTITION_LOCALITY,personsPrefetchEnabled: this.config.PERSONS_PREFETCH_ENABLED,cdpHogWatcherSampleRate: this.config.CDP_HOG_WATCHER_SAMPLE_RATE,@@ -443,13 +445,6 @@ export class IngestionConsumer {result = await this.joinedPipeline.next()}}-- private overflowEnabled(): boolean {- return (- !!this.config.INGESTION_CONSUMER_OVERFLOW_TOPIC &&- this.config.INGESTION_CONSUMER_OVERFLOW_TOPIC !== this.topic- )- }}async function timedHistogram<T>(diff --git a/nodejs/src/ingestion/pipelines/ai/consumer.test.ts b/nodejs/src/ingestion/pipelines/ai/consumer.test.tsindex d1a56c1d6b2d..6bcdd9df4ad9 100644--- a/nodejs/src/ingestion/pipelines/ai/consumer.test.ts+++ b/nodejs/src/ingestion/pipelines/ai/consumer.test.ts@@ -21,6 +21,7 @@ describe('createAiConsumer', () => {INGESTION_CONSUMER_CONSUME_TOPIC: 't',INGESTION_PIPELINE: 'ai',INGESTION_LANE: 'main',+ INGESTION_OVERFLOW_MODE: 'disabled',KAFKA_BATCH_START_LOGGING_ENABLED: false,INGESTION_CONSUMER_OVERFLOW_TOPIC: '',INGESTION_OVERFLOW_PRESERVE_PARTITION_LOCALITY: false,@@ -32,7 +33,6 @@ describe('createAiConsumer', () => {CDP_HOG_WATCHER_SAMPLE_RATE: 1,...({} as Pick<IngestionConsumerConfig,- | 'INGESTION_STATEFUL_OVERFLOW_ENABLED'| 'INGESTION_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS'| 'INGESTION_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS'| 'EVENT_OVERFLOW_BUCKET_CAPACITY'diff --git a/nodejs/src/ingestion/pipelines/ai/consumer.ts b/nodejs/src/ingestion/pipelines/ai/consumer.tsindex 701c0c40b433..5c98f0e44418 100644--- a/nodejs/src/ingestion/pipelines/ai/consumer.ts+++ b/nodejs/src/ingestion/pipelines/ai/consumer.ts@@ -42,8 +42,8 @@ export type AiConsumerConfig = CommonIngestionConsumerConfig &PersonHogConfig &Pick<IngestionConsumerConfig,+ | 'INGESTION_OVERFLOW_MODE'| 'INGESTION_CONSUMER_OVERFLOW_TOPIC'- | 'INGESTION_STATEFUL_OVERFLOW_ENABLED'| 'INGESTION_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS'| 'INGESTION_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS'| 'EVENT_OVERFLOW_BUCKET_CAPACITY'@@ -82,10 +82,7 @@ export type AiSharedScope = Scope<{export function createAiConsumer(config: AiConsumerConfig, sharedScope: AiSharedScope) {const splitTokens = (value: string): string[] => value.split(',').filter((x) => !!x)- const overflowEnabled =- !!config.INGESTION_CONSUMER_OVERFLOW_TOPIC &&- config.INGESTION_CONSUMER_OVERFLOW_TOPIC !== config.INGESTION_CONSUMER_CONSUME_TOPIC- const overflowLaneEnabled = config.INGESTION_LANE === 'overflow' && config.INGESTION_STATEFUL_OVERFLOW_ENABLED+ const overflowMode = config.INGESTION_OVERFLOW_MODEconst preservePartitionLocality = config.INGESTION_OVERFLOW_PRESERVE_PARTITION_LOCALITY// Client name for personhog read metrics: pipeline + lane (e.g. "ai/main").// The query name is supplied per call (e.g. "person-properties").@@ -119,20 +116,19 @@ export function createAiConsumer(config: AiConsumerConfig, sharedScope: AiShared// Dedicated 'ai' keyspace so AI overflow never affects analytics..add('overflowRedirectService',- overflowEnabled+ overflowMode === 'redirect'? new MainLaneOverflowRedirectComponent({redisRepository: container.overflowRedisRepository,localCacheTTLSeconds: config.INGESTION_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS,bucketCapacity: config.EVENT_OVERFLOW_BUCKET_CAPACITY,replenishRate: config.EVENT_OVERFLOW_BUCKET_REPLENISH_RATE,- statefulEnabled: config.INGESTION_STATEFUL_OVERFLOW_ENABLED,overflowType: 'ai',}): new DisabledOverflowRedirectComponent()).add('overflowLaneTTLRefreshService',- overflowLaneEnabled+ overflowMode === 'consume'? new OverflowLaneOverflowRedirectComponent({redisRepository: container.overflowRedisRepository,overflowType: 'ai',@@ -169,7 +165,7 @@ export function createAiConsumer(config: AiConsumerConfig, sharedScope: AiSharedgroupTypeManager: new ReadOnlyGroupTypeManager(new PersonHogGroupReadRepository(container.personhogClient, clientLabel)),- overflowEnabled,+ overflowMode,preservePartitionLocality,overflowRedirectService: container.overflowRedirectService,overflowLaneTTLRefreshService: container.overflowLaneTTLRefreshService,diff --git a/nodejs/src/ingestion/pipelines/ai/pipeline.test.ts b/nodejs/src/ingestion/pipelines/ai/pipeline.test.tsindex d77516ab7efe..56be3e8bc9b9 100644--- a/nodejs/src/ingestion/pipelines/ai/pipeline.test.ts+++ b/nodejs/src/ingestion/pipelines/ai/pipeline.test.ts@@ -167,7 +167,7 @@ describe('AiIngestionPipeline', () => {hogTransformer: mockHogTransformer as unknown as HogTransformer,personRepository: mockPersonRepository,groupTypeManager: mockGroupTypeManager,- overflowEnabled: false,+ overflowMode: 'disabled',preservePartitionLocality: false,overflowRedirectService: new DisabledOverflowRedirect(),overflowLaneTTLRefreshService: new DisabledOverflowRedirect(),diff --git a/nodejs/src/ingestion/pipelines/ai/pipeline.ts b/nodejs/src/ingestion/pipelines/ai/pipeline.tsindex 17b8e5704185..27833ad3b4ae 100644--- a/nodejs/src/ingestion/pipelines/ai/pipeline.ts+++ b/nodejs/src/ingestion/pipelines/ai/pipeline.ts@@ -51,6 +51,7 @@ import { createStripPersonUpdatePropertiesStep } from '~/ingestion/common/steps/import { createRecordIngestionLagStep } from '~/ingestion/common/steps/record-ingestion-lag'import { AI_EVENT_TYPES } from '~/ingestion/common/subpipelines/ai-event-types'import { addTeamToContext } from '~/ingestion/common/subpipelines/helpers'+import { IngestionOverflowMode } from '~/ingestion/config'import { newBatchingPipeline } from '~/ingestion/framework/builders'import { TopHogWrapper, sum, sumOk, sumResult } from '~/ingestion/framework/extensions/tophog'import { PipelineConfig } from '~/ingestion/framework/result-handling-pipeline'@@ -72,7 +73,7 @@ export interface AiIngestionPipelineConfig {// Read-only person/group access — the AI pipeline never writes persons or groups.personRepository: PersonReadRepositorygroupTypeManager: ReadOnlyGroupTypeManager- overflowEnabled: boolean+ overflowMode: IngestionOverflowModepreservePartitionLocality: booleanoverflowRedirectService: OverflowRedirectServiceoverflowLaneTTLRefreshService: OverflowRedirectService@@ -119,7 +120,7 @@ export function createAiIngestionPipeline<hogTransformer,personRepository,groupTypeManager,- overflowEnabled,+ overflowMode,preservePartitionLocality,overflowRedirectService,overflowLaneTTLRefreshService,@@ -155,7 +156,7 @@ export function createAiIngestionPipeline<.pipe(createAllowEventsStep([...AI_EVENT_TYPES])).pipe(createApplyEventRestrictionsStep(eventIngestionRestrictionManager, {- overflowEnabled,+ overflowMode,preservePartitionLocality,}))diff --git a/nodejs/src/ingestion/pipelines/analytics/joined-ingestion-pipeline.ts b/nodejs/src/ingestion/pipelines/analytics/joined-ingestion-pipeline.tsindex 7aba7a7e9ee2..af440eac1ea3 100644--- a/nodejs/src/ingestion/pipelines/analytics/joined-ingestion-pipeline.ts+++ b/nodejs/src/ingestion/pipelines/analytics/joined-ingestion-pipeline.ts@@ -43,6 +43,7 @@ import {createPersonsStoreBeforeBatchStep,} from '~/ingestion/common/steps/persons-store-batch-step'import { AiEventSubpipelineFactory } from '~/ingestion/common/subpipelines/ai-subpipeline.contract'+import { IngestionOverflowMode } from '~/ingestion/config'import { newBatchingPipeline } from '~/ingestion/framework/builders'import { TopHogRegistry, createTopHogWrapper } from '~/ingestion/framework/extensions/tophog'import { OkResultWithContext } from '~/ingestion/framework/pipeline.interface'@@ -69,7 +70,7 @@ import {export interface JoinedIngestionPipelineConfig {eventSchemaEnforcementEnabled: boolean- overflowEnabled: boolean+ overflowMode: IngestionOverflowModepreservePartitionLocality: booleanpersonsPrefetchEnabled: booleancdpHogWatcherSampleRate: number@@ -149,7 +150,7 @@ export function createJoinedIngestionPipeline<>(config: JoinedIngestionPipelineConfig, deps: JoinedIngestionPipelineDeps) {const {eventSchemaEnforcementEnabled,- overflowEnabled,+ overflowMode,preservePartitionLocality,personsPrefetchEnabled,cdpHogWatcherSampleRate,@@ -234,7 +235,7 @@ export function createJoinedIngestionPipeline<.pipe(createDenyEventsStep(['$exception', '$$client_ingestion_warning', '$$heatmap'])).pipe(createApplyEventRestrictionsStep(eventIngestionRestrictionManager, {- overflowEnabled,+ overflowMode,preservePartitionLocality,}))diff --git a/nodejs/src/ingestion/pipelines/errortracking/config.ts b/nodejs/src/ingestion/pipelines/errortracking/config.tsindex f6526432d6fd..484935b238bb 100644--- a/nodejs/src/ingestion/pipelines/errortracking/config.ts+++ b/nodejs/src/ingestion/pipelines/errortracking/config.ts@@ -13,7 +13,7 @@ import {INGESTION_UPSTREAM_PRODUCER,type ProducerName,} from '~/ingestion/common/outputs/producers'-import { IngestionLane } from '~/ingestion/config'+import { IngestionLane, IngestionOverflowMode } from '~/ingestion/config'export type ErrorTrackingConsumerConfig = {ERROR_TRACKING_CONSUMER_GROUP_ID: string@@ -28,8 +28,6 @@ export type ErrorTrackingConsumerConfig = {ERROR_TRACKING_OVERFLOW_BUCKET_CAPACITY: number/** Token bucket replenish rate (events per second) */ERROR_TRACKING_OVERFLOW_BUCKET_REPLENISH_RATE: number- /** When true, uses Redis to coordinate overflow state across pods */- ERROR_TRACKING_STATEFUL_OVERFLOW_ENABLED: boolean/** TTL in seconds for Redis overflow flags */ERROR_TRACKING_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS: number/** TTL in seconds for local cache entries */@@ -74,6 +72,8 @@ export type ErrorTrackingConsumerConfig = {INGESTION_PIPELINE: string | null/** Lane identifier (main, overflow) for metrics labeling */INGESTION_LANE: IngestionLane | null+ /** How this consumer participates in overflow handling (redirect / consume / disabled) */+ INGESTION_OVERFLOW_MODE: IngestionOverflowMode}export function getDefaultErrorTrackingConsumerConfig(): ErrorTrackingConsumerConfig {@@ -87,7 +87,6 @@ export function getDefaultErrorTrackingConsumerConfig(): ErrorTrackingConsumerCoERROR_TRACKING_CYMBAL_TIMEOUT_MS: 15000,ERROR_TRACKING_OVERFLOW_BUCKET_CAPACITY: 1000,ERROR_TRACKING_OVERFLOW_BUCKET_REPLENISH_RATE: 1.0,- ERROR_TRACKING_STATEFUL_OVERFLOW_ENABLED: false,ERROR_TRACKING_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS: 300, // 5 minutesERROR_TRACKING_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS: 60, // 1 minuteERROR_TRACKING_OVERFLOW_PRESERVE_PARTITION_LOCALITY: true,@@ -103,6 +102,7 @@ export function getDefaultErrorTrackingConsumerConfig(): ErrorTrackingConsumerCoERROR_TRACKING_PER_ISSUE_GUARD_COOLDOWN_TTL_SECONDS: 300,INGESTION_PIPELINE: null,INGESTION_LANE: null,+ INGESTION_OVERFLOW_MODE: 'disabled',}}diff --git a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.test.ts b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.test.tsindex 5cc920694f77..2f85e601b0b6 100644--- a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.test.ts+++ b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.test.ts@@ -144,13 +144,9 @@ describe('ErrorTrackingConsumer', () => {cymbalTimeoutMs: infra.config.ERROR_TRACKING_CYMBAL_TIMEOUT_MS,cymbalMaxBodyBytes: infra.config.ERROR_TRACKING_CYMBAL_MAX_BODY_BYTES,lane: infra.config.INGESTION_LANE ?? ('main' as const),- overflowEnabled:- !!infra.config.ERROR_TRACKING_CONSUMER_OVERFLOW_TOPIC &&- infra.config.ERROR_TRACKING_CONSUMER_OVERFLOW_TOPIC !==- infra.config.ERROR_TRACKING_CONSUMER_CONSUME_TOPIC,+ overflowMode: infra.config.INGESTION_OVERFLOW_MODE,overflowBucketCapacity: infra.config.ERROR_TRACKING_OVERFLOW_BUCKET_CAPACITY,overflowBucketReplenishRate: infra.config.ERROR_TRACKING_OVERFLOW_BUCKET_REPLENISH_RATE,- statefulOverflowEnabled: infra.config.ERROR_TRACKING_STATEFUL_OVERFLOW_ENABLED,statefulOverflowRedisTTLSeconds: infra.config.ERROR_TRACKING_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS,statefulOverflowLocalCacheTTLSeconds: infra.config.ERROR_TRACKING_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS,preservePartitionLocality: infra.config.ERROR_TRACKING_OVERFLOW_PRESERVE_PARTITION_LOCALITY,diff --git a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.ts b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.tsindex aae3fce55293..8a3453ae98e7 100644--- a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.ts+++ b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-consumer.ts@@ -25,7 +25,7 @@ import { MainLaneOverflowRedirect } from '~/ingestion/common/overflow-redirect/mimport { OverflowLaneOverflowRedirect } from '~/ingestion/common/overflow-redirect/overflow-lane-overflow-redirect'import { OverflowRedirectService } from '~/ingestion/common/overflow-redirect/overflow-redirect-service'import { RedisOverflowRepository } from '~/ingestion/common/overflow-redirect/overflow-redis-repository'-import { IngestionLane } from '~/ingestion/config'+import { IngestionLane, IngestionOverflowMode } from '~/ingestion/config'import { BatchPipelineUnwrapper } from '~/ingestion/framework/batch-pipeline-unwrapper'import { TopHog } from '~/ingestion/framework/tophog'import { PluginEvent } from '~/plugin-scaffold'@@ -53,10 +53,9 @@ export interface ErrorTrackingConsumerOptions {cymbalTimeoutMs: numbercymbalMaxBodyBytes: numberlane: IngestionLane- overflowEnabled: boolean+ overflowMode: IngestionOverflowModeoverflowBucketCapacity: numberoverflowBucketReplenishRate: number- statefulOverflowEnabled: booleanstatefulOverflowRedisTTLSeconds: numberstatefulOverflowLocalCacheTTLSeconds: number/**@@ -174,19 +173,18 @@ export class ErrorTrackingConsumer {})// Create overflow redirect service for main lane (rate limiting)- if (config.overflowEnabled && config.lane === 'main') {+ if (config.overflowMode === 'redirect') {this.overflowRedirectService = new MainLaneOverflowRedirect({redisRepository: overflowRedisRepository,localCacheTTLSeconds: config.statefulOverflowLocalCacheTTLSeconds,bucketCapacity: config.overflowBucketCapacity,replenishRate: config.overflowBucketReplenishRate,- statefulEnabled: config.statefulOverflowEnabled,overflowType: 'errortracking',})}// Create TTL refresh service for overflow lane- if (config.lane === 'overflow' && config.statefulOverflowEnabled) {+ if (config.overflowMode === 'consume') {this.overflowLaneTTLRefreshService = new OverflowLaneOverflowRedirect({redisRepository: overflowRedisRepository,overflowType: 'errortracking',@@ -249,9 +247,8 @@ export class ErrorTrackingConsumer {logger.info('🚀', `${this.name} - starting`, {groupId: this.config.groupId,topic: this.config.topic,- overflowEnabled: this.config.overflowEnabled,+ overflowMode: this.config.overflowMode,lane: this.config.lane,- statefulOverflowEnabled: this.config.statefulOverflowEnabled,cymbalUrl: this.config.cymbalBaseUrl,})@@ -292,7 +289,7 @@ export class ErrorTrackingConsumer {groupTypeManager: this.deps.groupTypeManager,cookielessManager: this.deps.cookielessManager,eventIngestionRestrictionManager: this.eventIngestionRestrictionManager,- overflowEnabled: this.config.overflowEnabled,+ overflowMode: this.config.overflowMode,preservePartitionLocality: this.config.preservePartitionLocality,overflowRedirectService: this.overflowRedirectService,overflowLaneTTLRefreshService: this.overflowLaneTTLRefreshService,diff --git a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.test.ts b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.test.tsindex 447f3acdeb38..323064d23c11 100644--- a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.test.ts+++ b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.test.ts@@ -320,7 +320,7 @@ describe('ErrorTrackingPipeline', () => {groupTypeManager: mockGroupTypeManager,cookielessManager: mockCookielessManager,eventIngestionRestrictionManager: mockEventIngestionRestrictionManager,- overflowEnabled: false,+ overflowMode: 'disabled',preservePartitionLocality: false,topHog: mockTopHog,}@@ -590,7 +590,7 @@ describe('ErrorTrackingPipeline', () => {// Enable overflow for this testconst configWithOverflow: ErrorTrackingPipelineConfig = {...pipelineConfig,- overflowEnabled: true,+ overflowMode: 'redirect',}const pipeline = createErrorTrackingPipeline(configWithOverflow)@@ -1007,7 +1007,7 @@ describe('ErrorTrackingPipeline', () => {const flagging = createMockOverflowRedirectService(new Set([`test-token-123:${COOKIELESS_SENTINEL_VALUE}`]))const configWithOverflow: ErrorTrackingPipelineConfig = {...pipelineConfig,- overflowEnabled: true,+ overflowMode: 'redirect',overflowRedirectService: flagging,}@@ -1035,7 +1035,7 @@ describe('ErrorTrackingPipeline', () => {const flagging = createMockOverflowRedirectService(new Set(['test-token-123:hashed-distinct-id']))const configWithOverflow: ErrorTrackingPipelineConfig = {...pipelineConfig,- overflowEnabled: true,+ overflowMode: 'redirect',overflowRedirectService: flagging,}diff --git a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.ts b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.tsindex 47c2603541c4..8fd8f6a538f9 100644--- a/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.ts+++ b/nodejs/src/ingestion/pipelines/errortracking/error-tracking-pipeline.ts@@ -34,6 +34,7 @@ import { createFetchPersonBatchStep } from '~/ingestion/common/steps/event-proceimport { createHogTransformEventStep } from '~/ingestion/common/steps/event-processing/hog-transform-event-step'import { createReadOnlyProcessGroupsStep } from '~/ingestion/common/steps/event-processing/readonly-process-groups-step'import { createRecordIngestionLagStep } from '~/ingestion/common/steps/record-ingestion-lag'+import { IngestionOverflowMode } from '~/ingestion/config'import { BatchPipelineUnwrapper } from '~/ingestion/framework/batch-pipeline-unwrapper'import { newBatchPipelineBuilder } from '~/ingestion/framework/builders'import { BatchPipelineBuilder } from '~/ingestion/framework/builders/batch-pipeline-builders'@@ -75,7 +76,7 @@ export interface ErrorTrackingPipelineConfig {groupTypeManager: ReadOnlyGroupTypeManagercookielessManager: CookielessManagereventIngestionRestrictionManager: EventIngestionRestrictionManager- overflowEnabled: boolean+ overflowMode: IngestionOverflowMode/*** When true, overflow redirects (both restriction-driven force-overflow* and rate-limit-to-overflow) keep the original partition key. When@@ -170,7 +171,7 @@ export function createErrorTrackingPipeline(groupTypeManager,cookielessManager,eventIngestionRestrictionManager,- overflowEnabled,+ overflowMode,preservePartitionLocality,overflowRedirectService,overflowLaneTTLRefreshService,@@ -194,7 +195,7 @@ export function createErrorTrackingPipeline(.sequentially((b) =>b.pipe(createParseHeadersStep()).pipe(createApplyEventRestrictionsStep(eventIngestionRestrictionManager, {- overflowEnabled,+ overflowMode,preservePartitionLocality,}))diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/consumer.ts b/nodejs/src/ingestion/pipelines/sessionreplay/consumer.tsindex 0d311eb4b39d..3753632263b8 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/consumer.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/consumer.ts@@ -38,7 +38,7 @@ import { TeamService } from '~/ingestion/pipelines/sessionreplay/shared/teams/teimport { KeyStore, RecordingEncryptor } from '~/ingestion/pipelines/sessionreplay/shared/types'import { HealthCheckResult, PluginServerService, RedisPool, ValueMatcher } from '~/types'-import { SessionRecordingApiConfig, SessionRecordingConfig, SessionReplayOutputsConfig } from './config'+import { SessionRecordingApiConfig, SessionRecordingConfig } from './config'import { KafkaOffsetManager } from './kafka/offset-manager'import { SessionRecordingIngesterMetrics } from './metrics'import { BlackholeSessionBatchFileStorage } from './sessions/blackhole-session-batch-writer'@@ -55,12 +55,10 @@ import { SessionTracker } from './sessions/session-tracker'*/export type SessionRecordingIngesterConfig = SessionRecordingConfig &SessionRecordingApiConfig &- // The consumer reads its overflow output topic to decide whether overflow is enabled.- Pick<SessionReplayOutputsConfig, 'INGESTION_SESSIONREPLAY_OUTPUT_OVERFLOW_TOPIC'> &Pick<IngestionConsumerConfig,- // For TopHog metrics- 'INGESTION_PIPELINE' | 'INGESTION_LANE'+ // INGESTION_OVERFLOW_MODE drives force-overflow routing; the rest are for TopHog metrics.+ 'INGESTION_OVERFLOW_MODE' | 'INGESTION_PIPELINE' | 'INGESTION_LANE'>/** Builds the session replay pipeline for a deployment (default or ML mirror). */@@ -322,7 +320,7 @@ export class SessionRecordingIngester {this.sessionReplayPipeline = this.createPipeline({outputs: this.outputs,eventIngestionRestrictionManager: this.eventIngestionRestrictionManager,- overflowEnabled: this.overflowEnabled(),+ overflowMode: this.config.INGESTION_OVERFLOW_MODE,promiseScheduler: this.promiseScheduler,teamService: this.teamService,retentionService: this.retentionService,@@ -435,11 +433,4 @@ export class SessionRecordingIngester {return Promise.resolve()})}-- private overflowEnabled(): boolean {- return (- !!this.config.INGESTION_SESSIONREPLAY_OUTPUT_OVERFLOW_TOPIC &&- this.config.INGESTION_SESSIONREPLAY_OUTPUT_OVERFLOW_TOPIC !== this.topic- )- }}diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.test.tsindex 112376c3a64e..6ffd373938e6 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.test.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.test.ts@@ -125,7 +125,7 @@ describe('ml-mirror-pipeline', () => {return createMlMirrorReplayPipeline({outputs,eventIngestionRestrictionManager: {} as unknown as EventIngestionRestrictionManager,- overflowEnabled: false,+ overflowMode: 'disabled',promiseScheduler,teamService: mockTeamService,retentionService,diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.ts b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.tsindex dece71432d22..daa4c2ec27f8 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/ml-mirror/ml-mirror-pipeline.ts@@ -41,7 +41,7 @@ export function createMlMirrorReplayPipeline(const {outputs,eventIngestionRestrictionManager,- overflowEnabled,+ overflowMode,promiseScheduler,teamService,retentionService,@@ -66,7 +66,7 @@ export function createMlMirrorReplayPipeline(.pipe(createParseHeadersStep()).pipe(createApplyEventRestrictionsStep(eventIngestionRestrictionManager, {- overflowEnabled,+ overflowMode,preservePartitionLocality: true,}))diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.test.ts b/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.test.tsindex c7493c4924c5..264b46e051e7 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.test.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.test.ts@@ -292,7 +292,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -327,7 +327,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -367,7 +367,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -522,7 +522,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -560,7 +560,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -614,7 +614,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -650,7 +650,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -682,7 +682,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -730,7 +730,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -770,7 +770,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -813,7 +813,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: teamServiceThatDropsSecond,retentionService,@@ -843,7 +843,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -870,7 +870,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -912,7 +912,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -937,7 +937,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -962,7 +962,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1003,7 +1003,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1039,7 +1039,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1071,7 +1071,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1102,7 +1102,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: teamServiceThatReturnsNull,retentionService,@@ -1129,7 +1129,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1160,7 +1160,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1191,7 +1191,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1222,7 +1222,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1274,7 +1274,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,@@ -1325,7 +1325,7 @@ describe('session-replay-pipeline', () => {const pipeline = createSessionReplayPipeline({outputs,eventIngestionRestrictionManager: mockRestrictionManager,- overflowEnabled: true,+ overflowMode: 'redirect',promiseScheduler,teamService: mockTeamService,retentionService,diff --git a/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.ts b/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.tsindex 27db04a05c60..171c144ed6f8 100644--- a/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.ts+++ b/nodejs/src/ingestion/pipelines/sessionreplay/session-replay-pipeline.ts@@ -5,6 +5,7 @@ import { IngestionOutputs } from '~/common/outputs/ingestion-outputs'import { EventIngestionRestrictionManager } from '~/common/utils/event-ingestion-restrictions'import { PromiseScheduler } from '~/common/utils/promise-scheduler'import { createApplyEventRestrictionsStep, createParseHeadersStep } from '~/ingestion/common/steps/event-preprocessing'+import { IngestionOverflowMode } from '~/ingestion/config'import { BatchPipeline } from '~/ingestion/framework/batch-pipeline.interface'import { newBatchPipelineBuilder } from '~/ingestion/framework/builders'import { TopHogRegistry, createTopHogWrapper, sum, timer } from '~/ingestion/framework/extensions/tophog'@@ -43,7 +44,7 @@ export interface SessionReplayPipelineOutput {export interface SessionReplayPipelineConfig {outputs: IngestionOutputs<IngestionWarningsOutput | DlqOutput | OverflowOutput>eventIngestionRestrictionManager: EventIngestionRestrictionManager- overflowEnabled: boolean+ overflowMode: IngestionOverflowModepromiseScheduler: PromiseSchedulerteamService: TeamService/** Resolves per-session retention before recording, so keys and storage route correctly */@@ -86,7 +87,7 @@ export function createSessionReplayPipeline(const {outputs,eventIngestionRestrictionManager,- overflowEnabled,+ overflowMode,promiseScheduler,teamService,retentionService,@@ -115,7 +116,7 @@ export function createSessionReplayPipeline(.pipe(createParseHeadersStep()).pipe(createApplyEventRestrictionsStep(eventIngestionRestrictionManager, {- overflowEnabled,+ overflowMode,preservePartitionLocality: true, // Sessions must stay on the same partition}))diff --git a/nodejs/src/servers/error-tracking-server.ts b/nodejs/src/servers/error-tracking-server.tsindex 5b18651d6d65..26eb04ff0c84 100644--- a/nodejs/src/servers/error-tracking-server.ts+++ b/nodejs/src/servers/error-tracking-server.ts@@ -204,13 +204,9 @@ export class ErrorTrackingServer implements NodeServer {cymbalTimeoutMs: this.config.ERROR_TRACKING_CYMBAL_TIMEOUT_MS,cymbalMaxBodyBytes: this.config.ERROR_TRACKING_CYMBAL_MAX_BODY_BYTES,lane: this.config.INGESTION_LANE ?? 'main',- overflowEnabled:- !!this.config.ERROR_TRACKING_CONSUMER_OVERFLOW_TOPIC &&- this.config.ERROR_TRACKING_CONSUMER_OVERFLOW_TOPIC !==- this.config.ERROR_TRACKING_CONSUMER_CONSUME_TOPIC,+ overflowMode: this.config.INGESTION_OVERFLOW_MODE,overflowBucketCapacity: this.config.ERROR_TRACKING_OVERFLOW_BUCKET_CAPACITY,overflowBucketReplenishRate: this.config.ERROR_TRACKING_OVERFLOW_BUCKET_REPLENISH_RATE,- statefulOverflowEnabled: this.config.ERROR_TRACKING_STATEFUL_OVERFLOW_ENABLED,statefulOverflowRedisTTLSeconds: this.config.ERROR_TRACKING_STATEFUL_OVERFLOW_REDIS_TTL_SECONDS,statefulOverflowLocalCacheTTLSeconds:this.config.ERROR_TRACKING_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS,diff --git a/nodejs/src/servers/ingestion-api-server.ts b/nodejs/src/servers/ingestion-api-server.tsindex 2c085a792a2e..a6d023fac922 100644--- a/nodejs/src/servers/ingestion-api-server.ts+++ b/nodejs/src/servers/ingestion-api-server.ts@@ -306,19 +306,18 @@ export class IngestionApiServer implements NodeServer {})let overflowRedirectService: OverflowRedirectService | undefined- if (this.overflowEnabled()) {+ if (this.config.INGESTION_OVERFLOW_MODE === 'redirect') {overflowRedirectService = new MainLaneOverflowRedirect({redisRepository: overflowRedisRepository,localCacheTTLSeconds: this.config.INGESTION_STATEFUL_OVERFLOW_LOCAL_CACHE_TTL_SECONDS,bucketCapacity: this.config.EVENT_OVERFLOW_BUCKET_CAPACITY,replenishRate: this.config.EVENT_OVERFLOW_BUCKET_REPLENISH_RATE,- statefulEnabled: this.config.INGESTION_STATEFUL_OVERFLOW_ENABLED,overflowType: 'events',})}let overflowLaneTTLRefreshService: OverflowRedirectService | undefined- if (this.config.INGESTION_LANE === 'overflow' && this.config.INGESTION_STATEFUL_OVERFLOW_ENABLED) {+ if (this.config.INGESTION_OVERFLOW_MODE === 'consume') {overflowLaneTTLRefreshService = new OverflowLaneOverflowRedirect({redisRepository: overflowRedisRepository,overflowType: 'events',@@ -362,7 +361,7 @@ export class IngestionApiServer implements NodeServer {// 7. Create the ingestion pipelineconst joinedPipelineConfig: JoinedIngestionPipelineConfig = {eventSchemaEnforcementEnabled: this.config.EVENT_SCHEMA_ENFORCEMENT_ENABLED,- overflowEnabled: this.overflowEnabled(),+ overflowMode: this.config.INGESTION_OVERFLOW_MODE,preservePartitionLocality: this.config.INGESTION_OVERFLOW_PRESERVE_PARTITION_LOCALITY,personsPrefetchEnabled: this.config.PERSONS_PREFETCH_ENABLED,cdpHogWatcherSampleRate: this.config.CDP_HOG_WATCHER_SAMPLE_RATE,@@ -529,13 +528,6 @@ export class IngestionApiServer implements NodeServer {return new HealthCheckResultOk()}- private overflowEnabled(): boolean {- return (- !!this.config.INGESTION_CONSUMER_OVERFLOW_TOPIC &&- this.config.INGESTION_CONSUMER_OVERFLOW_TOPIC !== this.config.INGESTION_CONSUMER_CONSUME_TOPIC- )- }-private getCleanupResources(): CleanupResources {return {kafkaProducers: [],