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(metrics): Use batch export id in SLA waiter (#93451)

Tomás Farías Santanacd2a5d5f7f13
diff --git a/products/batch_exports/backend/temporal/metrics.py b/products/batch_exports/backend/temporal/metrics.py
index c2dd77e151ca..392a2c5a408e 100644
--- a/products/batch_exports/backend/temporal/metrics.py
+++ b/products/batch_exports/backend/temporal/metrics.py
@@ -255,17 +255,19 @@ class _BatchExportsMetricsWorkflowInterceptor(WorkflowInboundInterceptor):
interval = input.args[0].interval.replace(" ", "_")
histogram_attributes: Attributes = {"interval": interval}
+ batch_export_id = getattr(input.args[0], "batch_export_id", None) or workflow_info.workflow_id
+
model = getattr(input.args[0], "batch_export_model", None)
_tag_span_with_batch_export_context(
{
- "batch_export.id": getattr(input.args[0], "batch_export_id", None),
+ "batch_export.id": batch_export_id,
"batch_export.destination": workflow_type.removesuffix("-export"),
"batch_export.interval": interval,
"batch_export.model": getattr(model, "name", None),
}
)
- async with SLAWaiter(batch_export_id=workflow_info.workflow_id, sla=get_sla_from_interval(interval)):
+ async with SLAWaiter(batch_export_id=batch_export_id, sla=get_sla_from_interval(interval)):
with ExecutionTimeRecorder(
"batch_exports_workflow_interval_execution_latency",
description="Histogram tracking execution latency for batch export workflows by interval",