From 919fa580976e95f3bae08b305a8c03f63c03d821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Van=C4=9Bk?= Date: Wed, 20 May 2026 10:59:21 +0200 Subject: [PATCH] feat(orch): record envd init duration histogram on failure with success attribute The histogram was previously only recorded on successful envd init. This makes it impossible to compute success/failure ratio per envd version in Grafana. By always recording with a success=true/false attribute, we can query the histogram count to get per-sandbox init outcomes and their duration distributions for both cases. --- packages/orchestrator/pkg/sandbox/sandbox.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/orchestrator/pkg/sandbox/sandbox.go b/packages/orchestrator/pkg/sandbox/sandbox.go index d033f05f2e..5e597e4ccc 100644 --- a/packages/orchestrator/pkg/sandbox/sandbox.go +++ b/packages/orchestrator/pkg/sandbox/sandbox.go @@ -1398,14 +1398,17 @@ func (s *Sandbox) WaitForEnvd( defer span.End() defer func() { - if e != nil { - return - } duration := time.Since(start).Milliseconds() waitForEnvdDurationHistogram.Record(ctx, duration, metric.WithAttributes( telemetry.WithEnvdVersion(s.Config.Envd.Version), attribute.Int64("timeout_ms", s.internalConfig.EnvdInitRequestTimeout.Milliseconds()), + attribute.Bool("success", e == nil), )) + + if e != nil { + return + } + // Update the sandbox as started now s.SetStartedAt(time.Now()) }()