Commit 0a0fd668 authored by tom's avatar tom

ENV for enabling tracing in Sentry

parent b69d05e1
...@@ -21,6 +21,7 @@ const config: Feature<{ ...@@ -21,6 +21,7 @@ const config: Feature<{
instance: string; instance: string;
release: string | undefined; release: string | undefined;
environment: string; environment: string;
enableTracing: boolean;
}> = (() => { }> = (() => {
if (dsn && instance && environment) { if (dsn && instance && environment) {
return Object.freeze({ return Object.freeze({
...@@ -30,6 +31,7 @@ const config: Feature<{ ...@@ -30,6 +31,7 @@ const config: Feature<{
instance, instance,
release, release,
environment, environment,
enableTracing: getEnvValue('NEXT_PUBLIC_SENTRY_ENABLE_TRACING') === 'true',
}); });
} }
......
...@@ -160,6 +160,12 @@ const sentrySchema = yup ...@@ -160,6 +160,12 @@ const sentrySchema = yup
then: (schema) => schema.test(urlTest), then: (schema) => schema.test(urlTest),
otherwise: (schema) => schema.max(-1, 'SENTRY_CSP_REPORT_URI cannot not be used without NEXT_PUBLIC_SENTRY_DSN'), otherwise: (schema) => schema.max(-1, 'SENTRY_CSP_REPORT_URI cannot not be used without NEXT_PUBLIC_SENTRY_DSN'),
}), }),
NEXT_PUBLIC_SENTRY_ENABLE_TRACING: yup
.boolean()
.when('NEXT_PUBLIC_SENTRY_DSN', {
is: (value: string) => Boolean(value),
then: (schema) => schema,
}),
NEXT_PUBLIC_APP_INSTANCE: yup NEXT_PUBLIC_APP_INSTANCE: yup
.string() .string()
.when('NEXT_PUBLIC_SENTRY_DSN', { .when('NEXT_PUBLIC_SENTRY_DSN', {
......
NEXT_PUBLIC_SENTRY_DSN=https://sentry.io
SENTRY_CSP_REPORT_URI=https://sentry.io
NEXT_PUBLIC_SENTRY_ENABLE_TRACING=true
NEXT_PUBLIC_APP_ENV=production
NEXT_PUBLIC_APP_INSTANCE=duck
\ No newline at end of file
...@@ -530,6 +530,7 @@ For blockchains that implementing SUAVE architecture additional fields will be s ...@@ -530,6 +530,7 @@ For blockchains that implementing SUAVE architecture additional fields will be s
| --- | --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- | --- |
| NEXT_PUBLIC_SENTRY_DSN | `string` | Client key for your Sentry.io app | Required | - | `<your-secret>` | | NEXT_PUBLIC_SENTRY_DSN | `string` | Client key for your Sentry.io app | Required | - | `<your-secret>` |
| SENTRY_CSP_REPORT_URI | `string` | URL for sending CSP-reports to your Sentry.io app | - | - | `<your-secret>` | | SENTRY_CSP_REPORT_URI | `string` | URL for sending CSP-reports to your Sentry.io app | - | - | `<your-secret>` |
| NEXT_PUBLIC_SENTRY_ENABLE_TRACING | `boolean` | Enables tracing and performance monitoring in Sentry.io | - | `false` | `true` |
| NEXT_PUBLIC_APP_ENV | `string` | App env (e.g development, review or production). Passed as `environment` property to Sentry config | - | `production` | `production` | | NEXT_PUBLIC_APP_ENV | `string` | App env (e.g development, review or production). Passed as `environment` property to Sentry config | - | `production` | `production` |
| NEXT_PUBLIC_APP_INSTANCE | `string` | Name of app instance. Used as custom tag `app_instance` value in the main Sentry scope. If not provided, it will be constructed from `NEXT_PUBLIC_APP_HOST` | - | - | `wonderful_kepler` | | NEXT_PUBLIC_APP_INSTANCE | `string` | Name of app instance. Used as custom tag `app_instance` value in the main Sentry scope. If not provided, it will be constructed from `NEXT_PUBLIC_APP_HOST` | - | - | `wonderful_kepler` |
......
...@@ -9,11 +9,22 @@ export const config: Sentry.BrowserOptions | undefined = (() => { ...@@ -9,11 +9,22 @@ export const config: Sentry.BrowserOptions | undefined = (() => {
return; return;
} }
const tracesSampleRate: number | undefined = (() => {
if (feature.environment === 'staging') {
return 1;
}
if (feature.environment === 'production' && feature.instance === 'eth') {
return 0.2;
}
})();
return { return {
environment: feature.environment, environment: feature.environment,
dsn: feature.dsn, dsn: feature.dsn,
release: feature.release, release: feature.release,
enableTracing: false, enableTracing: feature.enableTracing,
tracesSampleRate,
// error filtering settings // error filtering settings
// were taken from here - https://docs.sentry.io/platforms/node/guides/azure-functions/configuration/filtering/#decluttering-sentry // were taken from here - https://docs.sentry.io/platforms/node/guides/azure-functions/configuration/filtering/#decluttering-sentry
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment