bug(content): Fix SENTRY_TRACES_SAMPLE_RATE not being applied

Because:
- SENTRY_TRACES_SAMPLE_RATE was having no effect

This Commit:
- Fixes oversight where sample rate wasn't being copied into the config sent to client side
- Stops defaulting tracesSampleRate to 1.0, since this could result in quota exhaustion
This commit is contained in:
dschom 2024-03-08 12:06:46 -08:00
Родитель 0b0cf6e5a7
Коммит e7b4d56d48
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F26AEE99174EE68B
16 изменённых файлов: 19 добавлений и 14 удалений

Просмотреть файл

@ -110,7 +110,7 @@ function loadConf() {
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -91,7 +91,7 @@ const conf = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -122,7 +122,7 @@ const conf = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -1655,7 +1655,7 @@ const convictConf = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -38,6 +38,7 @@ const settingsConfig = {
dsn: config.get('sentry.dsn'),
env: config.get('sentry.env'),
sampleRate: config.get('sentry.sampleRate'),
tracesSampleRate: config.get('sentry.tracesSampleRate'),
clientName: config.get('sentry.clientName'),
serverName: config.get('sentry.serverName'),
},

Просмотреть файл

@ -778,7 +778,7 @@ const conf = (module.exports = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -34,6 +34,7 @@ module.exports = function (config) {
const SENTRY_CLIENT_DSN = config.get('sentry.dsn');
const SENTRY_CLIENT_ENV = config.get('sentry.env');
const SENTRY_SAMPLE_RATE = config.get('sentry.sampleRate');
const SENTRY_TRACES_SAMPLE_RATE = config.get('sentry.tracesSampleRate');
const SENTRY_CLIENT_NAME = config.get('sentry.clientName');
const OAUTH_SERVER_URL = config.get('oauth_url');
const PAIRING_CHANNEL_URI = config.get('pairing.server_base_uri');
@ -100,6 +101,7 @@ module.exports = function (config) {
env: SENTRY_CLIENT_ENV,
sampleRate: SENTRY_SAMPLE_RATE,
clientName: SENTRY_CLIENT_NAME,
tracesSampleRate: SENTRY_TRACES_SAMPLE_RATE,
},
staticResourceUrl: STATIC_RESOURCE_URL,
subscriptions: SUBSCRIPTIONS,

Просмотреть файл

@ -59,6 +59,7 @@ if (config.get('sentry.dsn')) {
dsn: config.get('sentry.dsn'),
env: config.get('sentry.env'),
sampleRate: config.get('sentry.sampleRate'),
tracesSampleRate: config.get('sentry.tracesSampleRate'),
serverName: config.get('sentry.serverName'),
},
},

Просмотреть файл

@ -330,7 +330,7 @@ module.exports = function (fs, path, url, convict) {
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -218,7 +218,7 @@ const conf = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -260,7 +260,7 @@ const conf = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -297,7 +297,7 @@ const conf = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -142,6 +142,7 @@ const expectedMergedConfig = {
dsn: 'https://foo.sentry.io/bar',
env: 'test',
sampleRate: 1.0,
tracesSampleRate: 0,
serverName: 'fxa-payments-server',
},
servers: {

Просмотреть файл

@ -15,13 +15,12 @@ export interface Config {
termsOfService: string;
};
newsletterId: string;
productRedirectURLs: {
[productId: string]: string;
};
productRedirectURLs: { [productId: string]: string };
sentry: {
dsn: string;
env: string;
sampleRate: number;
tracesSampleRate?: number;
clientName?: string;
serverName?: string;
};
@ -74,6 +73,7 @@ export function defaultConfig(): Config {
dsn: '',
env: 'local',
sampleRate: 1.0,
tracesSampleRate: 0,
serverName: 'fxa-payments-server',
clientName: 'fxa-payments-client',
},

Просмотреть файл

@ -341,7 +341,7 @@ const conf = convict({
},
tracesSampleRate: {
doc: 'Rate at which sentry traces are captured',
default: 1.0,
default: 0,
format: 'Number',
env: 'SENTRY_TRACES_SAMPLE_RATE',
},

Просмотреть файл

@ -35,7 +35,7 @@ export function buildSentryConfig(config: SentryConfigOpts, log: ILogger) {
clientName: config.sentry?.clientName,
serverName: config.sentry?.serverName,
fxaName: config.sentry?.clientName || config.sentry?.serverName,
tracesSampleRate: config.sentry?.tracesSampleRate || 1.0,
tracesSampleRate: config.sentry?.tracesSampleRate,
};
return opts;