fix(studio): show friendly error on infra-monitoring failure in db observability

The Database section of the observability overview page rendered the raw
infra-monitoring API error message (e.g. "duplicate time series") directly
in each metric card. Replace it with a static "Unable to load" message so
internal errors are no longer surfaced to users.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jordi EnricandClaude Opus 4.8 committed 2026-07-01 10:56:49 +02:00
1 parent a4820de066
commit 943d1a2647
1 file changed
+7 -9
@@ -100,10 +100,8 @@ export const DatabaseInfrastructureSection = ({
[infraData, maxConnectionsData]
)
const errorMessage =
infraError && typeof infraError === 'object' && 'message' in infraError
? String(infraError.message)
: 'Error loading data'
// Show a friendly, static message instead of leaking the raw API error to the user
const metricErrorState = <span className="text-xs text-foreground-lighter">Unable to load</span>
// Generate database report URL with time range parameters
const getDatabaseReportUrl = () => {
@@ -175,7 +173,7 @@ export const DatabaseInfrastructureSection = ({
</MetricCardHeader>
<MetricCardContent>
{infraError ? (
<div className="text-xs text-destructive wrap-break-word">{errorMessage}</div>
metricErrorState
) : connections.max > 0 ? (
<MetricCardValue>
{connections.peak}/{connections.max}
@@ -196,7 +194,7 @@ export const DatabaseInfrastructureSection = ({
</MetricCardHeader>
<MetricCardContent>
{infraError ? (
<div className="text-xs text-destructive wrap-break-word">{errorMessage}</div>
metricErrorState
) : metrics ? (
<MetricCardValue>{metrics.disk.current.toFixed(0)}%</MetricCardValue>
) : (
@@ -215,7 +213,7 @@ export const DatabaseInfrastructureSection = ({
</MetricCardHeader>
<MetricCardContent>
{infraError ? (
<div className="text-xs text-destructive wrap-break-word">{errorMessage}</div>
metricErrorState
) : metrics ? (
<MetricCardValue>{metrics.diskIo.current.toFixed(0)}%</MetricCardValue>
) : (
@@ -234,7 +232,7 @@ export const DatabaseInfrastructureSection = ({
</MetricCardHeader>
<MetricCardContent>
{infraError ? (
<div className="text-xs text-destructive wrap-break-word">{errorMessage}</div>
metricErrorState
) : metrics ? (
<MetricCardValue>{metrics.ram.current.toFixed(0)}%</MetricCardValue>
) : (
@@ -253,7 +251,7 @@ export const DatabaseInfrastructureSection = ({
</MetricCardHeader>
<MetricCardContent>
{infraError ? (
<div className="text-xs text-destructive wrap-break-word">{errorMessage}</div>
metricErrorState
) : metrics ? (
<MetricCardValue>{metrics.cpu.current.toFixed(0)}%</MetricCardValue>
) : (