Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Add sentry

Tomas Valenta6039b3b679af
diff --git a/.gitignore b/.gitignore
index c95914018..142621f57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,6 @@ next-env.d.ts
vale-styles
.idea/
+
+# Sentry Auth Token
+.sentryclirc
diff --git a/next.config.js b/next.config.js
index 4065383fa..c0f1b6fdc 100644
--- a/next.config.js
+++ b/next.config.js
@@ -36,3 +36,41 @@ const nextConfig = {
}
module.exports = nextConfig
+
+
+// Injected content via Sentry wizard below
+
+const { withSentryConfig } = require("@sentry/nextjs");
+
+module.exports = withSentryConfig(
+ module.exports,
+ {
+ // For all available options, see:
+ // https://github.com/getsentry/sentry-webpack-plugin#options
+
+ // Suppresses source map uploading logs during build
+ silent: true,
+
+ org: "devbook-7f",
+ project: "agent-dashboard",
+ },
+ {
+ // For all available options, see:
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
+
+ // Upload a larger set of source maps for prettier stack traces (increases build time)
+ widenClientFileUpload: true,
+
+ // Transpiles SDK to be compatible with IE11 (increases bundle size)
+ transpileClientSDK: true,
+
+ // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
+ tunnelRoute: "/monitoring",
+
+ // Hides source maps from generated client bundles
+ hideSourceMaps: true,
+
+ // Automatically tree-shake Sentry logger statements to reduce bundle size
+ disableLogger: true,
+ }
+);
diff --git a/package.json b/package.json
index ba77efe3d..a0be8aea3 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,8 @@
"scripts": {
"dev:next": "next dev",
"start:next": "next start",
- "dev": "npx concurrently -p none \"next dev\" \"npm run start:api\" \"npm run start:playground\"",
+ "dev-otel": "npx concurrently -p none \"next dev\" \"npm run start:api\" \"npm run start:playground\"",
+ "dev": "OTEL_SDK_DISABLED=\"true\" npx concurrently -p none \"next dev\" \"npm run start:api\" \"npm run start:playground\"",
"dev:api-service": "npx concurrently \"npm run start:api\" \"npm run start:playground\"",
"build": "next build",
"start:api": "cd api-service && cross-env PYTHONUNBUFFERED=1 OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES poetry run opentelemetry-instrument --service_name agent-api --exporter_otlp_endpoint \"ingest.lightstep.com:443\" --traces_exporter console,otlp_proto_grpc --metrics_exporter console,otlp_proto_grpc gunicorn --bind 0.0.0.0:49155 --reload --workers 1 --threads 2 --timeout 120 app:app -k uvicorn.workers.UvicornWorker",
@@ -47,6 +48,7 @@
"@octokit/webhooks": "^11.1.0",
"@opentelemetry/api": "^1.4.1",
"@prisma/client": "^4.13.0",
+ "@sentry/nextjs": "^7.55.2",
"@supabase/auth-helpers-nextjs": "^0.5.5",
"@supabase/auth-helpers-react": "^0.3.1",
"@supabase/supabase-js": "^2.10.0",
@@ -110,4 +112,4 @@
"tailwindcss": "^3.3.2",
"typescript": "^4.9.5"
}
-}
\ No newline at end of file
+}
diff --git a/sentry.client.config.ts b/sentry.client.config.ts
new file mode 100644
index 000000000..07935f0dc
--- /dev/null
+++ b/sentry.client.config.ts
@@ -0,0 +1,30 @@
+// This file configures the initialization of Sentry on the client.
+// The config you add here will be used whenever a users loads a page in their browser.
+// https://docs.sentry.io/platforms/javascript/guides/nextjs/
+
+import * as Sentry from "@sentry/nextjs";
+
+Sentry.init({
+ dsn: "https://[email protected]/4505360685924352",
+
+ // Adjust this value in production, or use tracesSampler for greater control
+ tracesSampleRate: 1,
+
+ // Setting this option to true will print useful information to the console while you're setting up Sentry.
+ debug: false,
+
+ replaysOnErrorSampleRate: 1.0,
+
+ // This sets the sample rate to be 10%. You may want this to be 100% while
+ // in development and sample at a lower rate in production
+ replaysSessionSampleRate: 0.1,
+
+ // You can remove this option if you're not planning to use the Sentry Session Replay feature:
+ integrations: [
+ new Sentry.Replay({
+ // Additional Replay configuration goes in here, for example:
+ maskAllText: true,
+ blockAllMedia: true,
+ }),
+ ],
+});
diff --git a/sentry.edge.config.ts b/sentry.edge.config.ts
new file mode 100644
index 000000000..315645623
--- /dev/null
+++ b/sentry.edge.config.ts
@@ -0,0 +1,16 @@
+// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
+// The config you add here will be used whenever one of the edge features is loaded.
+// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
+// https://docs.sentry.io/platforms/javascript/guides/nextjs/
+
+import * as Sentry from "@sentry/nextjs";
+
+Sentry.init({
+ dsn: "https://[email protected]/4505360685924352",
+
+ // Adjust this value in production, or use tracesSampler for greater control
+ tracesSampleRate: 1,
+
+ // Setting this option to true will print useful information to the console while you're setting up Sentry.
+ debug: false,
+});
diff --git a/sentry.server.config.ts b/sentry.server.config.ts
new file mode 100644
index 000000000..232bfe40e
--- /dev/null
+++ b/sentry.server.config.ts
@@ -0,0 +1,15 @@
+// This file configures the initialization of Sentry on the server.
+// The config you add here will be used whenever the server handles a request.
+// https://docs.sentry.io/platforms/javascript/guides/nextjs/
+
+import * as Sentry from "@sentry/nextjs";
+
+Sentry.init({
+ dsn: "https://[email protected]/4505360685924352",
+
+ // Adjust this value in production, or use tracesSampler for greater control
+ tracesSampleRate: 1,
+
+ // Setting this option to true will print useful information to the console while you're setting up Sentry.
+ debug: false,
+});