Connect to Lovable Cloud

Integrate Lovable Cloud tracing updates by enabling distributed tracing in edge functions, adjusting breadcrumb/trace propagation, and preparing RPC span handling. Files touched include edgeFunctionTracking and related RPC tracing scaffolding.
This commit is contained in:
gpt-engineer-app[bot]
2025-11-10 14:42:39 +00:00
parent 96adb2b15e
commit 89338a06ea
3 changed files with 285 additions and 31 deletions

View File

@@ -33,7 +33,7 @@ export async function invokeWithTracking<T = any>(
timeout: number = 30000,
retryOptions?: Partial<RetryOptions>,
customHeaders?: Record<string, string>
): Promise<{ data: T | null; error: any; requestId: string; duration: number; attempts?: number; status?: number }> {
): Promise<{ data: T | null; error: any; requestId: string; duration: number; attempts?: number; status?: number; traceId?: string }> {
// Configure retry options with defaults
const effectiveRetryOptions: RetryOptions = {
maxAttempts: retryOptions?.maxAttempts ?? 3,
@@ -84,8 +84,7 @@ export async function invokeWithTracking<T = any>(
breadcrumb.apiCall(
`/functions/${functionName}`,
'POST',
undefined,
{ traceId: effectiveTraceId, spanId }
undefined
);
try {
@@ -145,20 +144,22 @@ export async function invokeWithTracking<T = any>(
duration: timeout,
attempts: attemptCount,
status: 408,
traceId: undefined,
};
}
const errorMessage = getErrorMessage(error);
return {
data: null,
error: { message: errorMessage, status: (error as any)?.status },
requestId: 'unknown',
duration: 0,
attempts: attemptCount,
status: (error as any)?.status,
};
data: null,
error: { message: errorMessage, status: (error as any)?.status },
requestId: 'unknown',
duration: 0,
attempts: attemptCount,
status: (error as any)?.status,
traceId: undefined,
};
}
}
}
/**
* Invoke multiple edge functions in parallel with batch tracking