tangled
alpha
login
or
join now
danabra.mov
/
sidetrail
49
fork
atom
an app to share curated trails
sidetrail.app
atproto
nextjs
react
rsc
49
fork
atom
overview
issues
pulls
pipelines
add onRequestError log
danabra.mov
3 months ago
ddd2f3f1
e84afa38
+19
1 changed file
expand all
collapse all
unified
split
instrumentation.ts
+19
instrumentation.ts
···
1
1
import { registerOTel } from "@vercel/otel";
2
2
import { PgInstrumentation } from "@opentelemetry/instrumentation-pg";
3
3
+
import type { Instrumentation } from "next";
3
4
4
5
export function register() {
5
6
registerOTel({
···
7
8
instrumentations: [new PgInstrumentation()],
8
9
});
9
10
}
11
11
+
12
12
+
export const onRequestError: Instrumentation.onRequestError = async (err, request, context) => {
13
13
+
const error = err as Error & { digest?: string; cause?: unknown };
14
14
+
console.error("[onRequestError]", {
15
15
+
error: {
16
16
+
name: error.name,
17
17
+
message: error.message,
18
18
+
digest: error.digest,
19
19
+
cause: error.cause,
20
20
+
stack: error.stack,
21
21
+
},
22
22
+
request: {
23
23
+
method: request.method,
24
24
+
path: request.path,
25
25
+
},
26
26
+
context,
27
27
+
});
28
28
+
};