mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 09:11:12 -05:00
Add database persistence to 8 edge functions
Implement Phase 1 by adding error span logging and database persistence to 8 edge functions that already log errors: - detect-location - export-user-data - notify-moderators-submission - novu-webhook - send-escalation-notification - send-password-added-email - resend-deletion-code - merge-contact-tickets This update introduces startSpan/endSpan and logSpanToDatabase usage in catch blocks to ensure errors are recorded in the monitoring database.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
|
||||
import { corsHeadersWithTracing as corsHeaders } from '../_shared/cors.ts';
|
||||
import { edgeLogger, startRequest, endRequest } from "../_shared/logger.ts";
|
||||
import { edgeLogger, startRequest, endRequest, logSpanToDatabase, startSpan, endSpan } from "../_shared/logger.ts";
|
||||
import { formatEdgeError } from "../_shared/errorFormatter.ts";
|
||||
|
||||
interface IPLocationResponse {
|
||||
@@ -288,6 +288,11 @@ serve(async (req) => {
|
||||
requestId: tracking.requestId
|
||||
});
|
||||
|
||||
// Persist error to database for monitoring
|
||||
const errorSpan = startSpan('detect-location-error', 'SERVER');
|
||||
endSpan(errorSpan, 'error', error);
|
||||
logSpanToDatabase(errorSpan, tracking.requestId);
|
||||
|
||||
endRequest(tracking);
|
||||
|
||||
// Return default (metric) with 500 status to indicate error occurred
|
||||
|
||||
Reference in New Issue
Block a user