mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
Compare commits
6 Commits
refactor/c
...
otel-setup
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b793ba62a9 | ||
|
|
acedb24fb4 | ||
|
|
5411e96783 | ||
|
|
78efe18f25 | ||
|
|
3f3500e0f3 | ||
|
|
15ceb7c312 |
@@ -1,15 +1,8 @@
|
||||
"use client";
|
||||
|
||||
// import { useEffect } from "react";
|
||||
// import * as Sentry from "@sentry/nextjs";
|
||||
import NextError from "next/error";
|
||||
|
||||
// export default function GlobalError({ error }: { error: Error & { digest?: string } }) {
|
||||
export default function GlobalError() {
|
||||
// useEffect(() => {
|
||||
// Sentry.captureException(error);
|
||||
// }, [error]);
|
||||
|
||||
return (
|
||||
<html>
|
||||
<body>
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
export async function register() {
|
||||
if (process.env.NEXT_RUNTIME === "nodejs") {
|
||||
await import("./sentry.server.config");
|
||||
}
|
||||
|
||||
if (process.env.NEXT_RUNTIME === "edge") {
|
||||
await import("./sentry.edge.config");
|
||||
await import("./otel.config.js");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,41 +1,39 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/** @type {import("next").NextConfig} */
|
||||
require("dotenv").config({ path: ".env" });
|
||||
// const path = require("path");
|
||||
|
||||
const { withSentryConfig } = require("@sentry/nextjs");
|
||||
|
||||
const nextConfig = {
|
||||
trailingSlash: true,
|
||||
reactStrictMode: false,
|
||||
swcMinify: true,
|
||||
output: "standalone",
|
||||
webpack: (config, { isServer }) => {
|
||||
if (!isServer) {
|
||||
// Don't bundle opentelemetry for client-side
|
||||
config.resolve.fallback = {
|
||||
...config.resolve.fallback,
|
||||
"@opentelemetry/api": false,
|
||||
"@opentelemetry/sdk-node": false,
|
||||
"@opentelemetry/sdk-trace-node": false,
|
||||
"@opentelemetry/sdk-trace-base": false,
|
||||
"@opentelemetry/core": false,
|
||||
"@opentelemetry/semantic-conventions": false,
|
||||
"@opentelemetry/resources": false,
|
||||
"@opentelemetry/exporter-trace-otlp-http": false,
|
||||
};
|
||||
}
|
||||
return config;
|
||||
},
|
||||
async headers() {
|
||||
return [
|
||||
{
|
||||
source: "/(.*)?",
|
||||
headers: [
|
||||
{ key: "X-Frame-Options", value: "SAMEORIGIN" },
|
||||
// {
|
||||
// key: "Referrer-Policy",
|
||||
// value: "origin-when-cross-origin",
|
||||
// },
|
||||
// { key: "Cross-Origin-Opener-Policy", value: "same-origin" },
|
||||
// { key: "Cross-Origin-Embedder-Policy", value: "credentialless" },
|
||||
],
|
||||
headers: [{ key: "X-Frame-Options", value: "SAMEORIGIN" }],
|
||||
},
|
||||
];
|
||||
},
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
// webpack: (config, { isServer }) => {
|
||||
// if (!isServer) {
|
||||
// // Ensure that all imports of 'yjs' resolve to the same instance
|
||||
// config.resolve.alias["yjs"] = path.resolve(__dirname, "node_modules/yjs");
|
||||
// }
|
||||
// return config;
|
||||
// },
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
@@ -67,7 +65,6 @@ const nextConfig = {
|
||||
},
|
||||
async rewrites() {
|
||||
const posthogHost = process.env.NEXT_PUBLIC_POSTHOG_HOST || "https://app.posthog.com";
|
||||
const uploadsBaseURL = process.env.NEXT_PUBLIC_API_BASE_URL || "";
|
||||
const rewrites = [
|
||||
{
|
||||
source: "/ingest/static/:path*",
|
||||
@@ -95,39 +92,4 @@ const nextConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
const sentryConfig = {
|
||||
// For all available options, see:
|
||||
// https://github.com/getsentry/sentry-webpack-plugin#options
|
||||
org: process.env.SENTRY_ORG_ID || "plane-hq",
|
||||
project: process.env.SENTRY_PROJECT_ID || "plane-web",
|
||||
authToken: process.env.SENTRY_AUTH_TOKEN,
|
||||
// Only print logs for uploading source maps in CI
|
||||
silent: true,
|
||||
|
||||
// Upload a larger set of source maps for prettier stack traces (increases build time)
|
||||
widenClientFileUpload: true,
|
||||
|
||||
// Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
|
||||
// This can increase your server load as well as your hosting bill.
|
||||
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
|
||||
// side errors will fail.
|
||||
tunnelRoute: "/monitoring",
|
||||
|
||||
// Hides source maps from generated client bundles
|
||||
hideSourceMaps: true,
|
||||
|
||||
// Automatically tree-shake Sentry logger statements to reduce bundle size
|
||||
disableLogger: true,
|
||||
|
||||
// Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
|
||||
// See the following for more information:
|
||||
// https://docs.sentry.io/product/crons/
|
||||
// https://vercel.com/docs/cron-jobs
|
||||
automaticVercelMonitors: true,
|
||||
};
|
||||
|
||||
if (parseInt(process.env.SENTRY_MONITORING_ENABLED || "0", 10)) {
|
||||
module.exports = withSentryConfig(nextConfig, sentryConfig);
|
||||
} else {
|
||||
module.exports = nextConfig;
|
||||
}
|
||||
module.exports = nextConfig;
|
||||
|
||||
29
web/otel.config.ts
Normal file
29
web/otel.config.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
||||
import { Resource } from "@opentelemetry/resources";
|
||||
import { NodeSDK } from "@opentelemetry/sdk-node";
|
||||
import { SimpleSpanProcessor } from "@opentelemetry/sdk-trace-node";
|
||||
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
|
||||
import packageConfig from "./package.json";
|
||||
|
||||
const sdk = new NodeSDK({
|
||||
resource: new Resource({
|
||||
[ATTR_SERVICE_NAME]: process.env.OTEL_SERVICE_NAME || "plane-ce-web",
|
||||
[ATTR_SERVICE_VERSION]: packageConfig.version || "1.0.0",
|
||||
}),
|
||||
spanProcessor: new SimpleSpanProcessor(
|
||||
new OTLPTraceExporter({
|
||||
url: process.env.OTEL_COLLECTOR_URL || "https://telemetry.plane.so/v1/traces",
|
||||
})
|
||||
) as any,
|
||||
});
|
||||
|
||||
// Handle shutdown gracefully
|
||||
process.on("SIGTERM", () => {
|
||||
sdk
|
||||
.shutdown()
|
||||
.then(() => console.log("SDK shut down successfully"))
|
||||
.catch((error) => console.log("Error shutting down SDK", error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
|
||||
sdk.start();
|
||||
@@ -28,6 +28,13 @@
|
||||
"@nivo/line": "^0.88.0",
|
||||
"@nivo/pie": "^0.88.0",
|
||||
"@nivo/scatterplot": "^0.88.0",
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "^0.55.0",
|
||||
"@opentelemetry/resources": "^1.28.0",
|
||||
"@opentelemetry/sdk-node": "^0.54.0",
|
||||
"@opentelemetry/sdk-trace-base": "^1.28.0",
|
||||
"@opentelemetry/sdk-trace-node": "^1.28.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.27.0",
|
||||
"@plane/constants": "*",
|
||||
"@plane/editor": "*",
|
||||
"@plane/helpers": "*",
|
||||
@@ -35,7 +42,6 @@
|
||||
"@plane/ui": "*",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@react-pdf/renderer": "^3.4.5",
|
||||
"@sentry/nextjs": "^8.32.0",
|
||||
"axios": "^1.7.4",
|
||||
"clsx": "^2.0.0",
|
||||
"cmdk": "^1.0.0",
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
// 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 { replayIntegration, init } from "@sentry/nextjs";
|
||||
|
||||
init({
|
||||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "development",
|
||||
|
||||
// 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: [
|
||||
replayIntegration({
|
||||
// Additional Replay configuration goes in here, for example:
|
||||
maskAllText: true,
|
||||
blockAllMedia: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
@@ -1,17 +0,0 @@
|
||||
// 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 { init } from "@sentry/nextjs";
|
||||
|
||||
init({
|
||||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "development",
|
||||
|
||||
// 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,
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
defaults.url=https://sentry.io/
|
||||
defaults.org=plane
|
||||
defaults.project=plane-web
|
||||
@@ -1,19 +0,0 @@
|
||||
// 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: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "development",
|
||||
|
||||
// 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,
|
||||
|
||||
// Uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
||||
// spotlight: process.env.NODE_ENV === 'development',
|
||||
});
|
||||
Reference in New Issue
Block a user