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.

fix(tracing): keep attribute fixtures inside TTL (#71966)

Raúl Negrón-Otero581d773ab739
diff --git a/products/tracing/backend/tests/test_attribute_value_search.py b/products/tracing/backend/tests/test_attribute_value_search.py
index 93d638765a6f..523dbf49ffb9 100644
--- a/products/tracing/backend/tests/test_attribute_value_search.py
+++ b/products/tracing/backend/tests/test_attribute_value_search.py
@@ -27,6 +27,9 @@ class TestTracingAttributeValueSearch(ClickhouseTestMixin, APIBaseTest):
sync_execute(TRACE_ATTRIBUTES_DISTRIBUTED_TABLE_SQL())
bucket = dt.datetime(2026, 6, 2, 8, 0, 0).strftime("%Y-%m-%d %H:%M:%S")
+ # trace_attributes has `TTL original_expiry_time_bucket`; a past value lets a background
+ # merge empty the fixture mid-run.
+ expiry_bucket = (dt.datetime.now(dt.UTC) + dt.timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S")
# attribute_type values mirror the deployed MVs in bin/clickhouse-logs.sql.
rows = [
# (key, value, count, type)
@@ -41,7 +44,7 @@ class TestTracingAttributeValueSearch(ClickhouseTestMixin, APIBaseTest):
("promo.alt", "50ABCoff", 4, "span_attribute"),
]
values_sql = ",".join(
- f"({cls.team.id}, '{bucket}', '{bucket}', 'svc', 0, '{k}', '{v}', {c}, '{t}')" for k, v, c, t in rows
+ f"({cls.team.id}, '{bucket}', '{expiry_bucket}', 'svc', 0, '{k}', '{v}', {c}, '{t}')" for k, v, c, t in rows
)
sync_execute(
"INSERT INTO trace_attributes (team_id, time_bucket, original_expiry_time_bucket, service_name, "