You've already forked domainstack.io
mirror of
https://github.com/jakejarvis/domainstack.io.git
synced 2025-12-02 19:33:48 -05:00
27 lines
744 B
TypeScript
27 lines
744 B
TypeScript
import { registerOTel } from "@vercel/otel";
|
|
import type { Instrumentation } from "next";
|
|
|
|
export const register = () => {
|
|
registerOTel({ serviceName: "domainstack" });
|
|
};
|
|
|
|
export const onRequestError: Instrumentation.onRequestError = async (
|
|
error,
|
|
request,
|
|
) => {
|
|
// Only track errors in Node.js runtime (not Edge)
|
|
if (process.env.NEXT_RUNTIME === "nodejs") {
|
|
try {
|
|
// Use logger for structured error logging
|
|
const { logger } = await import("@/lib/logger/server");
|
|
logger.error("request error", error, {
|
|
source: "instrumentation",
|
|
path: request.path,
|
|
method: request.method,
|
|
});
|
|
} catch {
|
|
// Graceful degradation - don't throw to avoid breaking the request
|
|
}
|
|
}
|
|
};
|