Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

refactor(sentry-config): disable tracing & ensure correct environment (#11552)

Vinicius Lourenço4cf8125372d0
diff --git a/.github/workflows/build-enterprise.yaml b/.github/workflows/build-enterprise.yaml
index ee362806f9..00da44c45e 100644
--- a/.github/workflows/build-enterprise.yaml
+++ b/.github/workflows/build-enterprise.yaml
@@ -69,6 +69,8 @@ jobs:
echo 'VITE_APPCUES_APP_ID="${{ secrets.APPCUES_APP_ID }}"' >> frontend/.env
echo 'VITE_PYLON_IDENTITY_SECRET="${{ secrets.PYLON_IDENTITY_SECRET }}"' >> frontend/.env
echo 'VITE_DOCS_BASE_URL="https://signoz.io"' >> frontend/.env
+ echo 'VITE_ENVIRONMENT="production"' >> frontend/.env
+ echo 'VITE_VERSION="${{ steps.build-info.outputs.version }}"' >> frontend/.env
- name: cache-dotenv
uses: actions/cache@v4
with:
diff --git a/.github/workflows/build-staging.yaml b/.github/workflows/build-staging.yaml
index d6f3a71e41..cad4489d4f 100644
--- a/.github/workflows/build-staging.yaml
+++ b/.github/workflows/build-staging.yaml
@@ -70,6 +70,8 @@ jobs:
echo 'VITE_APPCUES_APP_ID="${{ secrets.NP_APPCUES_APP_ID }}"' >> frontend/.env
echo 'VITE_PYLON_IDENTITY_SECRET="${{ secrets.NP_PYLON_IDENTITY_SECRET }}"' >> frontend/.env
echo 'VITE_DOCS_BASE_URL="https://staging.signoz.io"' >> frontend/.env
+ echo 'VITE_ENVIRONMENT="staging"' >> frontend/.env
+ echo 'VITE_VERSION="${{ steps.build-info.outputs.version }}"' >> frontend/.env
- name: cache-dotenv
uses: actions/cache@v4
with:
diff --git a/.github/workflows/gor-signoz.yaml b/.github/workflows/gor-signoz.yaml
index 34c59a964d..2555894cd2 100644
--- a/.github/workflows/gor-signoz.yaml
+++ b/.github/workflows/gor-signoz.yaml
@@ -35,6 +35,8 @@ jobs:
echo 'VITE_APPCUES_APP_ID="${{ secrets.APPCUES_APP_ID }}"' >> .env
echo 'VITE_PYLON_IDENTITY_SECRET="${{ secrets.PYLON_IDENTITY_SECRET }}"' >> .env
echo 'VITE_DOCS_BASE_URL="https://signoz.io"' >> .env
+ echo 'VITE_ENVIRONMENT="production"' >> .env
+ echo 'VITE_VERSION="${{ github.ref_name }}"' >> .env
- name: node-setup
uses: actions/setup-node@v5
with:
diff --git a/frontend/src/AppRoutes/index.tsx b/frontend/src/AppRoutes/index.tsx
index 62a28ae1d8..d3322079e4 100644
--- a/frontend/src/AppRoutes/index.tsx
+++ b/frontend/src/AppRoutes/index.tsx
@@ -351,19 +351,18 @@ function App(): JSX.Element {
Sentry.init({
dsn: process.env.SENTRY_DSN,
tunnel: process.env.TUNNEL_URL,
- environment: 'production',
+ environment: process.env.ENVIRONMENT,
+ release: process.env.VERSION,
integrations: [
+ // Kept for the `transaction` tag used in routing, even though
+ // tracing is disabled. Ref: https://github.com/SigNoz/platform-pod/issues/2393#issuecomment-4603658055
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: false,
blockAllMedia: false,
}),
],
- // Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: [],
- // Session Replay
+ tracesSampleRate: 0, // Ref: https://github.com/SigNoz/platform-pod/issues/2393#issuecomment-4603658055
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
beforeSend(event) {
diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts
index 25f2e72292..43316dd0d0 100644
--- a/frontend/src/vite-env.d.ts
+++ b/frontend/src/vite-env.d.ts
@@ -24,6 +24,8 @@ interface ImportMetaEnv {
readonly VITE_TUNNEL_URL: string;
readonly VITE_TUNNEL_DOMAIN: string;
readonly VITE_DOCS_BASE_URL: string;
+ readonly VITE_ENVIRONMENT: string;
+ readonly VITE_VERSION: string;
}
interface ImportMeta {
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index eb9132da10..f866a344be 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -82,11 +82,20 @@ export default defineConfig(({ mode }): UserConfig => {
];
if (env.VITE_SENTRY_AUTH_TOKEN) {
+ // Refuse to upload sourcemaps without an explicit version.
+ if (!env.VITE_VERSION) {
+ throw new Error(
+ 'VITE_VERSION must be set to upload sourcemaps to Sentry; refusing to upload without a matching release.',
+ );
+ }
plugins.push(
sentryVitePlugin({
authToken: env.VITE_SENTRY_AUTH_TOKEN,
org: env.VITE_SENTRY_ORG,
project: env.VITE_SENTRY_PROJECT_ID,
+ // Pin the sourcemap-upload release to the same value injected as
+ // process.env.VERSION so uploaded sourcemaps resolve. Ref: platform-pod#2393
+ release: { name: env.VITE_VERSION },
}),
);
}
@@ -155,6 +164,8 @@ export default defineConfig(({ mode }): UserConfig => {
'process.env.TUNNEL_URL': JSON.stringify(env.VITE_TUNNEL_URL),
'process.env.TUNNEL_DOMAIN': JSON.stringify(env.VITE_TUNNEL_DOMAIN),
'process.env.DOCS_BASE_URL': JSON.stringify(env.VITE_DOCS_BASE_URL),
+ 'process.env.ENVIRONMENT': JSON.stringify(env.VITE_ENVIRONMENT),
+ 'process.env.VERSION': JSON.stringify(env.VITE_VERSION),
},
// In production, use relative paths so assets work with any base path injected by the backend.
// In dev, use the configured base path for proper HMR and routing.