Skip to content

Commit

Permalink
fix: remove edge reports in favor of vercel default reports
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielelpidio committed Dec 11, 2024
1 parent 793efba commit effacec
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/withAxiom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NextConfig } from 'next';
import { Rewrite } from 'next/dist/lib/load-custom-routes';
import { config, isEdgeRuntime, isVercelIntegration } from './config';
import { config, isEdgeRuntime } from './config';
import { LogLevel, Logger, RequestReport } from './logger';
import { type NextRequest, type NextResponse } from 'next/server';
import { EndpointType, RequestJSON, requestToJSON } from './shared';
Expand Down Expand Up @@ -124,9 +124,6 @@ export function withAxiomRouteHandler(handler: NextHandler, config?: AxiomRouteH

// flush the logger along with the child logger
await logger.flush();
if (isEdgeRuntime && isVercelIntegration) {
logEdgeReport(report);
}
return result;
} catch (error: any) {
report.endTime = new Date().getTime();
Expand All @@ -144,18 +141,11 @@ export function withAxiomRouteHandler(handler: NextHandler, config?: AxiomRouteH
log.attachResponseStatus(500);

await logger.flush();
if (isEdgeRuntime && isVercelIntegration) {
logEdgeReport(report);
}
throw error;
}
};
}

function logEdgeReport(report: RequestReport) {
console.log(`AXIOM_EDGE_REPORT::${JSON.stringify(report)}`);
}

type WithAxiomParam = NextConfig | NextHandler;

function isNextConfig(param: WithAxiomParam): param is NextConfig {
Expand Down

0 comments on commit effacec

Please sign in to comment.