Skip to content

Add retrieval of sandboxes metrics from edge - #1588

Merged
jakubno merged 5 commits into
mainfrom
forward-sandbox-metrics-from-byoc-clickhouse-through-edge-eng-3373
Dec 8, 2025
Merged

jakubno merged 5 commits into
mainfrom
forward-sandbox-metrics-from-byoc-clickhouse-through-edge-eng-3373

Conversation

@jakubno

@jakubno jakubno commented Dec 8, 2025 •

Copy link
Copy Markdown
Member

Note

Adds edge-backed retrieval for sandbox metrics (single and list) gated by a feature flag, with ClickHouse fallback and improved flag context/error handling.

  • Handlers:
    • Add LaunchDarkly contexts (sandbox/team) and use new EdgeProvidedSandboxMetricsFlagName to choose metrics source.
    • For GetSandboxesSandboxIDMetrics and GetSandboxesMetrics, route to edge clients when enabled; otherwise use ClickHouse.
    • Extract API-backed helpers (getApiProvidedMetrics, getApiProvidedSandboxListMetrics) returning api.APIError; adjust logging and responses.
  • Edge client (packages/api/internal/edge/metrics.go):
    • New helpers GetClusterSandboxMetrics and GetClusterSandboxListMetrics calling edge HTTP APIs and mapping to api.SandboxMetric.
    • Uniform error handling for HTTP status, empty bodies, and client errors.
  • Feature flags:
    • Add EdgeProvidedSandboxMetricsFlagName (edge-provided-sandbox-metrics) and register in LaunchDarkly offline store.

Written by Cursor Bugbot for commit 8dd48bc. This will update automatically on new commits. Configure here.

@linear

linear Bot commented Dec 8, 2025

Copy link
Copy Markdown

Comment thread packages/api/internal/handlers/sandboxes_list_metrics.go Outdated
Comment thread packages/api/internal/edge/metrics.go Outdated
Comment thread packages/api/internal/edge/metrics.go Outdated
Comment thread packages/api/internal/edge/metrics.go
Comment thread packages/api/internal/handlers/sandbox_metrics.go Outdated
Comment thread packages/api/internal/handlers/sandbox_metrics.go
Comment thread packages/api/internal/handlers/sandboxes_list_metrics.go
@jakubno
jakubno merged commit 8ba6236 into main Dec 8, 2025
28 checks passed
@jakubno
jakubno deleted the forward-sandbox-metrics-from-byoc-clickhouse-through-edge-eng-3373 branch December 8, 2025 16:29
arkamar added a commit that referenced this pull request Jul 1, 2026
This flag was a temporary migration toggle from #1588 for the
sandbox-metrics read path. The consuming code was removed in 9cc1504
("Make edge api optional for OSS deployment", #1638), which collapsed
onto a single cluster resource provider but left this declaration behind
as dead code. No references remain.

Link: #1638
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants