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.

chore(logs): drop stale patterns write from drop-rule form payload (#67599)

Daniel Visca9dbc0c669206
diff --git a/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.test.ts b/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.test.ts
index b4be7f9adf97..9aec481e645f 100644
--- a/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.test.ts
+++ b/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.test.ts
@@ -19,7 +19,24 @@ const rateLimitForm = (overrides: Partial<LogsSamplingFormType> = {}): LogsSampl
...overrides,
})
-describe('logsSamplingFormLogic rate-limit serialization', () => {
+describe('logsSamplingFormLogic serialization', () => {
+ it('serializes a path_drop rule into filter_group-only config', () => {
+ const innerGroup = {
+ type: FilterLogicalOperator.And,
+ values: [{ key: 'service.name', operator: 'exact', value: 'api', type: 'log_resource_attribute' }],
+ } as LogsSamplingFormType['filter_group']
+
+ const config = buildSamplingConfigPayload(
+ rateLimitForm({ rule_type: RuleTypeEnumApi.PathDrop, filter_group: innerGroup })
+ )
+
+ // The whole config is the wrapped filter group — the worker evaluates
+ // config.filter_group directly, and nothing else belongs in the payload.
+ expect(config).toEqual({
+ filter_group: { type: FilterLogicalOperator.And, values: [innerGroup] },
+ })
+ })
+
it.each([
['1', 'MB/s', 1000],
['50', 'KB/s', 50],
diff --git a/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts b/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts
index b00f19d93f24..7c623cf0e195 100644
--- a/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts
+++ b/products/logs/frontend/components/LogsSampling/logsSamplingFormLogic.ts
@@ -156,12 +156,7 @@ export function buildSamplingConfigPayload(form: LogsSamplingFormType): Record<s
filter_group: wrapFilterGroup(form.filter_group),
}
}
- // `patterns: []` keeps the existing path_drop config validator happy.
- // Backend filter_group evaluation is wired in the follow-up PR; today the
- // worker reads `patterns` only, so rules saved through the new UI are
- // no-ops on the ingestion path until that lands.
return {
- patterns: [],
filter_group: wrapFilterGroup(form.filter_group),
}
}