an app to share curated trails
sidetrail.app
atproto
nextjs
react
rsc
1import { registerOTel } from "@vercel/otel";
2import { PgInstrumentation } from "@opentelemetry/instrumentation-pg";
3import type { Instrumentation } from "next";
4
5export function register() {
6 registerOTel({
7 serviceName: process.env.OTEL_SERVICE_NAME || "sidetrail-app",
8 instrumentations: [new PgInstrumentation()],
9 });
10}
11
12export const onRequestError: Instrumentation.onRequestError = async (err, request, context) => {
13 const error = err as Error & { digest?: string; cause?: unknown };
14 console.error("[onRequestError]", {
15 error: {
16 name: error.name,
17 message: error.message,
18 digest: error.digest,
19 cause: error.cause,
20 stack: error.stack,
21 },
22 request: {
23 method: request.method,
24 path: request.path,
25 },
26 context,
27 });
28};