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.

feat(logs-ingestion): KB-based rate-limit drop rules (#59520)

Daniel Visca7a1a46cc3cc4
diff --git a/nodejs/src/logs-ingestion/sampling/compile-rules.ts b/nodejs/src/logs-ingestion/sampling/compile-rules.ts
index f7ee8b693aa5..bb00bd23ddb8 100644
--- a/nodejs/src/logs-ingestion/sampling/compile-rules.ts
+++ b/nodejs/src/logs-ingestion/sampling/compile-rules.ts
@@ -59,23 +59,40 @@ function parseSeverityActions(raw: unknown): [SeverityAction, SeverityAction, Se
const MAX_LOGS_PER_SECOND = 1_000_000
const MAX_BURST_LOGS = 10_000_000
+const MAX_KB_PER_SECOND = 1_000_000
+const MAX_BURST_KB = 10_000_000
+const BYTES_PER_KB = 1024
function parseRateLimitFromConfig(
config: Record<string, unknown>
-): { refillPerSecond: number; poolMax: number } | null {
+): { refillPerSecond: number; poolMax: number; costUnit: 'records' | 'bytes' } | null {
+ // KB-mode takes precedence when both fields are set. The API validator rejects that
+ // case at write time, but the ingestion path stays robust to legacy or hand-crafted rows.
+ const kbps = config.kb_per_second
+ if (typeof kbps === 'number' && Number.isFinite(kbps) && kbps >= 1 && kbps <= MAX_KB_PER_SECOND) {
+ const refillKb = Math.floor(kbps)
+ const burstRaw = config.burst_kb
+ const burstKb =
+ typeof burstRaw === 'number' && Number.isFinite(burstRaw) && burstRaw >= refillKb
+ ? Math.min(Math.floor(burstRaw), MAX_BURST_KB)
+ : Math.min(refillKb * 3, MAX_BURST_KB)
+ return {
+ refillPerSecond: refillKb * BYTES_PER_KB,
+ poolMax: burstKb * BYTES_PER_KB,
+ costUnit: 'bytes',
+ }
+ }
const lps = config.logs_per_second
if (typeof lps !== 'number' || !Number.isFinite(lps) || lps < 1 || lps > MAX_LOGS_PER_SECOND) {
return null
}
const refill = Math.floor(lps)
const burstRaw = config.burst_logs
- let poolMax: number
- if (typeof burstRaw === 'number' && Number.isFinite(burstRaw) && burstRaw >= refill) {
- poolMax = Math.min(Math.floor(burstRaw), MAX_BURST_LOGS)
- } else {
- poolMax = Math.min(refill * 3, MAX_BURST_LOGS)
- }
- return { refillPerSecond: refill, poolMax }
+ const poolMax =
+ typeof burstRaw === 'number' && Number.isFinite(burstRaw) && burstRaw >= refill
+ ? Math.min(Math.floor(burstRaw), MAX_BURST_LOGS)
+ : Math.min(refill * 3, MAX_BURST_LOGS)
+ return { refillPerSecond: refill, poolMax, costUnit: 'records' }
}
/**
diff --git a/nodejs/src/logs-ingestion/sampling/evaluate.test.ts b/nodejs/src/logs-ingestion/sampling/evaluate.test.ts
index 6229da06c4a8..c9ab42eab52f 100644
--- a/nodejs/src/logs-ingestion/sampling/evaluate.test.ts
+++ b/nodejs/src/logs-ingestion/sampling/evaluate.test.ts
@@ -172,7 +172,7 @@ describe('evaluateLogRecord', () => {
},
])
expect(rs.hasRateLimitRules).toBe(true)
- expect(rs.rules[0]?.rateLimit).toEqual({ refillPerSecond: 100, poolMax: 300 })
+ expect(rs.rules[0]?.rateLimit).toEqual({ refillPerSecond: 100, poolMax: 300, costUnit: 'records' })
})
it('classifySamplingRecord defers to rate_limit when first matching rule', () => {
diff --git a/nodejs/src/logs-ingestion/sampling/evaluate.ts b/nodejs/src/logs-ingestion/sampling/evaluate.ts
index 139946e07c9d..7c2b0aa9dfee 100644
--- a/nodejs/src/logs-ingestion/sampling/evaluate.ts
+++ b/nodejs/src/logs-ingestion/sampling/evaluate.ts
@@ -37,8 +37,12 @@ export type CompiledSamplingRule = {
latencyMsGt: number | null
attributePredicates: { key: string; op: string; value?: string }[]
} | null
- /** Set for rate_limit rules with valid config; ingestion uses Redis token bucket (logs/sec). */
- rateLimit: { refillPerSecond: number; poolMax: number } | null
+ /**
+ * Set for rate_limit rules with valid config. Token-bucket on Redis; `costUnit` controls
+ * whether each record consumes one token (`'records'`) or its own `bytes_uncompressed`
+ * (`'bytes'`). `refillPerSecond` and `poolMax` are expressed in the matching unit.
+ */
+ rateLimit: { refillPerSecond: number; poolMax: number; costUnit: 'records' | 'bytes' } | null
}
export type CompiledRuleSet = {
diff --git a/nodejs/src/logs-ingestion/sampling/logs-sampling.service.test.ts b/nodejs/src/logs-ingestion/sampling/logs-sampling.service.test.ts
index 3bd0ae99737b..bee35e7bc565 100644
--- a/nodejs/src/logs-ingestion/sampling/logs-sampling.service.test.ts
+++ b/nodejs/src/logs-ingestion/sampling/logs-sampling.service.test.ts
@@ -132,6 +132,87 @@ describe('LogsSamplingService', () => {
expect(result.bytesDroppedByRuleId.get('rl-1')).toBe(750)
})
+ it('KB-mode admits records while accumulated bytes fit the budget', async () => {
+ const ruleSet = compileRuleSet([
+ {
+ id: 'rl-kb',
+ rule_type: 'rate_limit',
+ scope_service: 'api',
+ scope_path_pattern: null,
+ scope_attribute_filters: [],
+ config: { kb_per_second: 1, burst_kb: 2 },
+ },
+ ])
+ // 3 rows of 300, 400, 500 bytes. Budget = 1024 bytes (1 KB).
+ // Walk: 300 ≤ 1024 (admit), 300+400 ≤ 1024 (admit), 700+500 > 1024 (drop).
+ const buffer = await encodeLogRecords(LOG_RECORD_AVRO, 'zstandard', [
+ baseLog('a', 'api', 300),
+ baseLog('b', 'api', 400),
+ baseLog('c', 'api', 500),
+ ])
+
+ const mockRedis: RedisV2 = {
+ useClient: jest.fn(() => Promise.resolve(null)),
+ usePipeline: jest.fn((_opts, cb) => {
+ const pipeline = { checkRateLimitV2: jest.fn() } as unknown as RedisClientPipeline
+ cb(pipeline)
+ const pipelineResult: [Error | null, any][] = [[null, [1024, 0] as const]]
+ return Promise.resolve(pipelineResult)
+ }),
+ }
+
+ const service = new LogsSamplingService(mockRedis, 60)
+ const result = await service.processBuffer(buffer, logsSettings, ruleSet, 99)
+
+ expect(result.recordsDropped).toBe(1)
+ expect(result.recordsDroppedByRuleId.get('rl-kb')).toBe(1)
+ expect(result.bytesDropped).toBe(500)
+ expect(result.bytesDroppedByRuleId.get('rl-kb')).toBe(500)
+
+ const [, , kept] = await decodeLogRecords(result.value)
+ expect(kept).toHaveLength(2)
+ })
+
+ it('KB-mode treats null bytes_uncompressed as zero-cost (in-flight producer rollout)', async () => {
+ const ruleSet = compileRuleSet([
+ {
+ id: 'rl-kb',
+ rule_type: 'rate_limit',
+ scope_service: 'api',
+ scope_path_pattern: null,
+ scope_attribute_filters: [],
+ config: { kb_per_second: 1, burst_kb: 2 },
+ },
+ ])
+ // Rows: 200, null (old-producer message), 1000. Budget = 1024.
+ // Walk: 200 (admit), 200+0 = 200 (admit), 200+1000 > 1024 (drop).
+ const buffer = await encodeLogRecords(LOG_RECORD_AVRO, 'zstandard', [
+ baseLog('a', 'api', 200),
+ baseLog('b', 'api', null),
+ baseLog('c', 'api', 1000),
+ ])
+
+ const mockRedis: RedisV2 = {
+ useClient: jest.fn(() => Promise.resolve(null)),
+ usePipeline: jest.fn((_opts, cb) => {
+ const pipeline = { checkRateLimitV2: jest.fn() } as unknown as RedisClientPipeline
+ cb(pipeline)
+ const pipelineResult: [Error | null, any][] = [[null, [1024, 0] as const]]
+ return Promise.resolve(pipelineResult)
+ }),
+ }
+
+ const service = new LogsSamplingService(mockRedis, 60)
+ const result = await service.processBuffer(buffer, logsSettings, ruleSet, 99)
+
+ expect(result.recordsDropped).toBe(1)
+ expect(result.bytesDropped).toBe(1000)
+ expect(result.bytesDroppedByRuleId.get('rl-kb')).toBe(1000)
+
+ const [, , kept] = await decodeLogRecords(result.value)
+ expect(kept).toHaveLength(2)
+ })
+
it('fail-open keeps all rate_limit lines when Redis pipeline returns null', async () => {
const ruleSet = compileRuleSet([
{
diff --git a/nodejs/src/logs-ingestion/sampling/logs-sampling.service.ts b/nodejs/src/logs-ingestion/sampling/logs-sampling.service.ts
index 92ce4bfaad3f..ec61dc21aa2d 100644
--- a/nodejs/src/logs-ingestion/sampling/logs-sampling.service.ts
+++ b/nodejs/src/logs-ingestion/sampling/logs-sampling.service.ts
@@ -116,7 +116,7 @@ export class LogsSamplingService {
pendingByRule.set(c.ruleId, list)
}
}
- const rateKeep = await this.applyRateLimits(teamId, ruleSet, pendingByRule)
+ const rateKeep = await this.applyRateLimits(teamId, ruleSet, pendingByRule, records)
for (let i = 0; i < records.length; i++) {
const record = records[i]!
@@ -196,13 +196,16 @@ export class LogsSamplingService {
/**
* Maps a recordIndex -> keep (true) or drop (false) decision per rate_limit rule.
- * Each rule's pending lines share one Lua call; lines are admitted up to the
- * pre-batch token budget.
+ * Each rule's pending lines share one Lua call; lines are admitted while their
+ * accumulated cost stays within the pre-batch token budget. Cost is one token
+ * per record (`costUnit: 'records'`) or each record's `bytes_uncompressed`
+ * (`costUnit: 'bytes'`); rows missing the field contribute 0.
*/
private async applyRateLimits(
teamId: number,
ruleSet: CompiledRuleSet,
- pendingByRule: RateLimitPendingByRule
+ pendingByRule: RateLimitPendingByRule,
+ records: LogRecord[]
): Promise<Map<number, boolean>> {
const keepByIndex = new Map<number, boolean>()
if (pendingByRule.size === 0) {
@@ -210,7 +213,7 @@ export class LogsSamplingService {
}
const ruleById = new Map(ruleSet.rules.map((r) => [r.id, r]))
- type Entry = { indices: number[]; req: KeyedRateLimitRequest }
+ type Entry = { indices: number[]; costs: number[]; req: KeyedRateLimitRequest }
const entries: Entry[] = []
for (const [ruleId, indices] of pendingByRule) {
@@ -218,11 +221,15 @@ export class LogsSamplingService {
if (!rl || indices.length === 0) {
continue
}
+ const costs =
+ rl.costUnit === 'bytes' ? indices.map((idx) => recordBytes(records[idx]!)) : indices.map(() => 1)
+ const totalCost = costs.reduce((a, b) => a + b, 0)
entries.push({
indices,
+ costs,
req: {
id: `${teamId}/${ruleId}`,
- cost: indices.length,
+ cost: totalCost,
bucketSize: rl.poolMax,
refillRate: rl.refillPerSecond,
},
@@ -241,12 +248,17 @@ export class LogsSamplingService {
const results = await this.rateLimiter.rateLimitMany(entries.map((e) => e.req))
for (let i = 0; i < entries.length; i++) {
- const { indices } = entries[i]!
+ const { indices, costs } = entries[i]!
const tokensBefore = results[i]?.[1].tokensBefore ?? 0
const budget = Math.max(0, Math.floor(tokensBefore))
- const toAdmit = Math.min(indices.length, budget)
+ let spent = 0
for (let j = 0; j < indices.length; j++) {
- keepByIndex.set(indices[j]!, j < toAdmit)
+ const next = spent + costs[j]!
+ const admit = next <= budget
+ keepByIndex.set(indices[j]!, admit)
+ if (admit) {
+ spent = next
+ }
}
}
diff --git a/products/logs/backend/sampling_api.py b/products/logs/backend/sampling_api.py
index 2f31150259fb..1080fb90e1a5 100644
--- a/products/logs/backend/sampling_api.py
+++ b/products/logs/backend/sampling_api.py
@@ -116,8 +116,11 @@ class LogsSamplingRuleSerializer(serializers.ModelSerializer):
'Filter group example: `{"type":"AND","values":[{"type":"AND","values":['
'{"key":"service.name","operator":"exact","value":"api"}]}]}`. '
"For severity_sampling: object with `actions` per severity level and optional `always_keep`. "
- "For rate_limit: object with required `logs_per_second` (integer KB/s, 1–1000000 = 1 GB/s) and optional `burst_logs` "
- "(integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to."
+ "For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` "
+ "integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB/s, "
+ "optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional "
+ "`filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own "
+ "uncompressed byte size, matching how billing measures ingested bytes."
)
)
version = serializers.IntegerField(
@@ -171,27 +174,61 @@ class LogsSamplingRuleSerializer(serializers.ModelSerializer):
if not isinstance(config, dict):
raise ValidationError({"config": "rate_limit rules require config to be a JSON object."})
self._validate_filter_group(config.get("filter_group"))
- lps = config.get("logs_per_second")
- if isinstance(lps, bool) or not isinstance(lps, int):
- raise ValidationError(
- {"config": {"logs_per_second": "Must be an integer (logs per second sustained)."}}
- )
- if lps < 1 or lps > 1_000_000:
- raise ValidationError(
- {"config": {"logs_per_second": "Must be between 1 KB/s and 1000000 KB/s (1 GB/s) inclusive."}}
- )
- burst = config.get("burst_logs", None)
- if burst is not None:
- if isinstance(burst, bool) or not isinstance(burst, int):
- raise ValidationError({"config": {"burst_logs": "Must be an integer when provided."}})
- if burst < lps:
- raise ValidationError(
- {"config": {"burst_logs": "Must be greater than or equal to logs_per_second."}}
- )
- if burst > 10_000_000:
- raise ValidationError({"config": {"burst_logs": "Must be at most 10000000 KB."}})
+ self._validate_rate_limit_config(config)
return attrs
+ def _validate_rate_limit_config(self, config: dict[str, Any]) -> None:
+ # A rate_limit rule charges either one token per log line (`logs_per_second` +
+ # optional `burst_logs`) or one token per byte of `bytes_uncompressed`
+ # (`kb_per_second` + optional `burst_kb`). The two shapes are mutually
+ # exclusive — picking one or the other is a deliberate operator choice that
+ # changes how billing reconciles. Older rules using `logs_per_second` continue
+ # to work unchanged.
+ has_lines = "logs_per_second" in config
+ has_kb = "kb_per_second" in config
+ if has_lines and has_kb:
+ raise ValidationError(
+ {"config": "Set either `logs_per_second` or `kb_per_second` on a rate_limit rule, not both."}
+ )
+ if not has_lines and not has_kb:
+ raise ValidationError({"config": "rate_limit rules require either `logs_per_second` or `kb_per_second`."})
+ if has_kb:
+ self._validate_rate_limit_kb(config)
+ else:
+ self._validate_rate_limit_lines(config)
+
+ def _validate_rate_limit_lines(self, config: dict[str, Any]) -> None:
+ lps = config.get("logs_per_second")
+ if isinstance(lps, bool) or not isinstance(lps, int):
+ raise ValidationError({"config": {"logs_per_second": "Must be an integer (logs per second sustained)."}})
+ if lps < 1 or lps > 1_000_000:
+ raise ValidationError({"config": {"logs_per_second": "Must be between 1 and 1000000 logs/sec inclusive."}})
+ burst = config.get("burst_logs", None)
+ if burst is not None:
+ if isinstance(burst, bool) or not isinstance(burst, int):
+ raise ValidationError({"config": {"burst_logs": "Must be an integer when provided."}})
+ if burst < lps:
+ raise ValidationError({"config": {"burst_logs": "Must be greater than or equal to logs_per_second."}})
+ if burst > 10_000_000:
+ raise ValidationError({"config": {"burst_logs": "Must be at most 10000000 logs."}})
+
+ def _validate_rate_limit_kb(self, config: dict[str, Any]) -> None:
+ kbps = config.get("kb_per_second")
+ if isinstance(kbps, bool) or not isinstance(kbps, int):
+ raise ValidationError({"config": {"kb_per_second": "Must be an integer (kilobytes per second sustained)."}})
+ if kbps < 1 or kbps > 1_000_000:
+ raise ValidationError(
+ {"config": {"kb_per_second": "Must be between 1 KB/s and 1000000 KB/s (1 GB/s) inclusive."}}
+ )
+ burst = config.get("burst_kb", None)
+ if burst is not None:
+ if isinstance(burst, bool) or not isinstance(burst, int):
+ raise ValidationError({"config": {"burst_kb": "Must be an integer when provided."}})
+ if burst < kbps:
+ raise ValidationError({"config": {"burst_kb": "Must be greater than or equal to kb_per_second."}})
+ if burst > 10_000_000:
+ raise ValidationError({"config": {"burst_kb": "Must be at most 10000000 KB."}})
+
def _validate_filter_group(self, filter_group: Any) -> None:
if filter_group is None:
return
diff --git a/products/logs/backend/test/test_sampling_rules_api.py b/products/logs/backend/test/test_sampling_rules_api.py
index d8b3c90d7f57..d6fd85e005b6 100644
--- a/products/logs/backend/test/test_sampling_rules_api.py
+++ b/products/logs/backend/test/test_sampling_rules_api.py
@@ -100,6 +100,45 @@ class TestLogsSamplingRulesAPI(APIBaseTest):
assert body["config"]["logs_per_second"] == 5000
assert body["config"]["burst_logs"] == 15000
+ def test_create_rate_limit_kb_success(self):
+ # KB-mode is the new shape: cost-per-record is the row's bytes_uncompressed,
+ # matching how billing measures ingested bytes.
+ response = self.client.post(
+ self.base_url,
+ self._payload(
+ name="Cap api by bytes",
+ rule_type="rate_limit",
+ scope_service="payment-api",
+ config={"kb_per_second": 500, "burst_kb": 1500},
+ ),
+ format="json",
+ )
+ assert response.status_code == status.HTTP_201_CREATED, response.json()
+ body = response.json()
+ assert body["config"]["kb_per_second"] == 500
+ assert body["config"]["burst_kb"] == 1500
+
+ # Configs that should be rejected by the rate_limit validator. Keep this list
+ # close to the inverse of `test_create_rate_limit_*_success` — every accepted
+ # shape has a symmetric set of rejection cases here.
+ INVALID_RATE_LIMIT_CONFIGS = [
+ ("both_modes_set", {"logs_per_second": 100, "kb_per_second": 100}),
+ ("neither_mode_set", {}),
+ ("kb_per_second_below_min", {"kb_per_second": 0}),
+ ("kb_per_second_above_max", {"kb_per_second": 1_000_001}),
+ ("burst_kb_below_kb_per_second", {"kb_per_second": 500, "burst_kb": 100}),
+ ("burst_kb_above_max", {"kb_per_second": 1, "burst_kb": 10_000_001}),
+ ]
+
+ @parameterized.expand([(label, payload) for label, payload in INVALID_RATE_LIMIT_CONFIGS])
+ def test_create_rate_limit_rejects_invalid_config(self, _label, invalid_config):
+ response = self.client.post(
+ self.base_url,
+ self._payload(rule_type="rate_limit", scope_service="payment-api", config=invalid_config),
+ format="json",
+ )
+ assert response.status_code == status.HTTP_400_BAD_REQUEST, response.json()
+
def test_create_path_drop_with_valid_filter_group(self):
# The drop-rules UI writes the inner group wrapped in an outer AND envelope.
filter_group = {
diff --git a/products/logs/frontend/generated/api.schemas.ts b/products/logs/frontend/generated/api.schemas.ts
index 07bebd452d1d..57caf1f63b85 100644
--- a/products/logs/frontend/generated/api.schemas.ts
+++ b/products/logs/frontend/generated/api.schemas.ts
@@ -1180,7 +1180,7 @@ export interface LogsSamplingRuleApi {
scope_path_pattern?: string | null
/** Optional list of predicates over string attributes, e.g. [{"key":"http.route","op":"eq","value":"/api"}]. */
scope_attribute_filters?: LogsSamplingRuleApiScopeAttributeFiltersItem[]
- /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with required `logs_per_second` (integer KB/s, 1–1000000 = 1 GB/s) and optional `burst_logs` (integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to. */
+ /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes. */
config: unknown
/** Incremented on each update for worker cache coherency. */
readonly version: number
@@ -1237,7 +1237,7 @@ export interface PatchedLogsSamplingRuleApi {
scope_path_pattern?: string | null
/** Optional list of predicates over string attributes, e.g. [{"key":"http.route","op":"eq","value":"/api"}]. */
scope_attribute_filters?: PatchedLogsSamplingRuleApiScopeAttributeFiltersItem[]
- /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with required `logs_per_second` (integer KB/s, 1–1000000 = 1 GB/s) and optional `burst_logs` (integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to. */
+ /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes. */
config?: unknown
/** Incremented on each update for worker cache coherency. */
readonly version?: number
diff --git a/products/logs/frontend/generated/api.zod.ts b/products/logs/frontend/generated/api.zod.ts
index e55e032eca47..0c36981ec2b9 100644
--- a/products/logs/frontend/generated/api.zod.ts
+++ b/products/logs/frontend/generated/api.zod.ts
@@ -797,7 +797,7 @@ export const LogsSamplingRulesCreateBody = /* @__PURE__ */ zod.object({
config: zod
.unknown()
.describe(
- 'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with required `logs_per_second` (integer KB\/s, 1–1000000 = 1 GB\/s) and optional `burst_logs` (integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to.'
+ 'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB\/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes.'
),
})
@@ -850,7 +850,7 @@ export const LogsSamplingRulesUpdateBody = /* @__PURE__ */ zod.object({
config: zod
.unknown()
.describe(
- 'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with required `logs_per_second` (integer KB\/s, 1–1000000 = 1 GB\/s) and optional `burst_logs` (integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to.'
+ 'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB\/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes.'
),
})
@@ -909,7 +909,7 @@ export const LogsSamplingRulesPartialUpdateBody = /* @__PURE__ */ zod.object({
.unknown()
.optional()
.describe(
- 'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with required `logs_per_second` (integer KB\/s, 1–1000000 = 1 GB\/s) and optional `burst_logs` (integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to.'
+ 'Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND\/OR tree of property predicates evaluated per record) and\/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{\"type\":\"AND\",\"values\":[{\"type\":\"AND\",\"values\":[{\"key\":\"service.name\",\"operator\":\"exact\",\"value\":\"api\"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB\/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes.'
),
})
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 836e8c68688e..7f915ec87687 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -20435,7 +20435,7 @@ export namespace Schemas {
scope_path_pattern?: string | null;
/** Optional list of predicates over string attributes, e.g. [{"key":"http.route","op":"eq","value":"/api"}]. */
scope_attribute_filters?: LogsSamplingRuleScopeAttributeFiltersItem[];
- /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with required `logs_per_second` (integer KB/s, 1–1000000 = 1 GB/s) and optional `burst_logs` (integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to. */
+ /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes. */
config: unknown;
/** Incremented on each update for worker cache coherency. */
readonly version: number;
@@ -28158,7 +28158,7 @@ export namespace Schemas {
scope_path_pattern?: string | null;
/** Optional list of predicates over string attributes, e.g. [{"key":"http.route","op":"eq","value":"/api"}]. */
scope_attribute_filters?: PatchedLogsSamplingRuleScopeAttributeFiltersItem[];
- /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with required `logs_per_second` (integer KB/s, 1–1000000 = 1 GB/s) and optional `burst_logs` (integer KB ≥ logs_per_second, max 10000000) and optional `filter_group` to narrow which logs the cap applies to. */
+ /** Type-specific JSON. For path_drop: object with optional `filter_group` (PropertyGroupFilter shape — AND/OR tree of property predicates evaluated per record) and/or legacy `patterns` (list of regex strings) + `match_attribute_key` (string). When both are present a record is dropped if EITHER matches. Filter group example: `{"type":"AND","values":[{"type":"AND","values":[{"key":"service.name","operator":"exact","value":"api"}]}]}`. For severity_sampling: object with `actions` per severity level and optional `always_keep`. For rate_limit: object with EITHER `logs_per_second` (integer 1–1000000, optional `burst_logs` integer ≥ logs_per_second, max 10000000) OR `kb_per_second` (integer 1–1000000 = 1 GB/s, optional `burst_kb` integer ≥ kb_per_second, max 10000000) — not both. Plus optional `filter_group` to narrow which logs the cap applies to. KB-mode charges each log its own uncompressed byte size, matching how billing measures ingested bytes. */
config?: unknown;
/** Incremented on each update for worker cache coherency. */
readonly version?: number;