Skip to content

Commit

Permalink
feat: add PrismaInstrumentation
Browse files Browse the repository at this point in the history
  • Loading branch information
simonknittel committed Jan 25, 2025
1 parent f5cefba commit caccdf7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
45 changes: 45 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@opentelemetry/sdk-logs": "0.57.1",
"@paralleldrive/cuid2": "2.2.2",
"@prisma/client": "6.2.1",
"@prisma/instrumentation": "6.2.1",
"@pusher/push-notifications-server": "1.2.7",
"@pusher/push-notifications-web": "1.1.0",
"@radix-ui/react-alert-dialog": "1.1.4",
Expand Down
6 changes: 5 additions & 1 deletion app/src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { PrismaInstrumentation } from "@prisma/instrumentation";
import { registerOTel } from "@vercel/otel";
import { env } from "./env";

export const register = () => {
if (env.ENABLE_INSTRUMENTATION !== "true") return;
if (!env.OTEL_EXPORTER_OTLP_PROTOCOL || !env.OTEL_EXPORTER_OTLP_ENDPOINT)
return;
registerOTel({ serviceName: "sam" });
registerOTel({
serviceName: "sam",
instrumentations: [new PrismaInstrumentation()],
});
};

0 comments on commit caccdf7

Please sign in to comment.