diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 592bee1e41..6e475ab861 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -81,7 +81,7 @@ exports[`should create default config 1`] = ` "notifications": false, "projectStatusApi": false, "proxyReturnAllToggles": false, - "responseTimeWithAppName": false, + "responseTimeWithAppNameKillSwitch": false, "showProjectApiAccess": false, "strictSchemaValidation": false, }, @@ -102,7 +102,7 @@ exports[`should create default config 1`] = ` "notifications": false, "projectStatusApi": false, "proxyReturnAllToggles": false, - "responseTimeWithAppName": false, + "responseTimeWithAppNameKillSwitch": false, "showProjectApiAccess": false, "strictSchemaValidation": false, }, diff --git a/src/lib/middleware/response-time-metrics.ts b/src/lib/middleware/response-time-metrics.ts index f7a0edfe3c..8c4372e714 100644 --- a/src/lib/middleware/response-time-metrics.ts +++ b/src/lib/middleware/response-time-metrics.ts @@ -20,7 +20,7 @@ export function responseTimeMetrics( let appName; if ( - flagResolver.isEnabled('responseTimeWithAppName') && + !flagResolver.isEnabled('responseTimeWithAppNameKillSwitch') && (instanceStatsService.getAppCountSnapshot('7d') ?? appNameReportingThreshold) < appNameReportingThreshold ) { diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index b4a304e282..e23509e0a6 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -22,8 +22,8 @@ const flags = { process.env.UNLEASH_EXPERIMENTAL_EMBED_PROXY_FRONTEND, true, ), - responseTimeWithAppName: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_RESPONSE_TIME_WITH_APP_NAME, + responseTimeWithAppNameKillSwitch: parseEnvVarBoolean( + process.env.UNLEASH_RESPONSE_TIME_WITH_APP_NAME_KILL_SWITCH, false, ), proxyReturnAllToggles: parseEnvVarBoolean( diff --git a/src/server-dev.ts b/src/server-dev.ts index f203514d45..e3a7b59d6e 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -37,7 +37,7 @@ process.nextTick(async () => { embedProxy: true, embedProxyFrontend: true, anonymiseEventLog: false, - responseTimeWithAppName: true, + responseTimeWithAppNameKillSwitch: false, maintenance: true, featuresExportImport: true, newProjectOverview: true, diff --git a/website/docs/reference/deploy/configuring-unleash.md b/website/docs/reference/deploy/configuring-unleash.md index bf8a92f4a9..1999f7206d 100644 --- a/website/docs/reference/deploy/configuring-unleash.md +++ b/website/docs/reference/deploy/configuring-unleash.md @@ -131,6 +131,7 @@ unleash.start(unleashOptions); - **frontendApi** - Configuration options for the [Unleash front-end API](../front-end-api.md). - `refreshIntervalInMs` - how often (in milliseconds) front-end clients should refresh their data from the cache. Overridable with the `FRONTEND_API_REFRESH_INTERVAL_MS` environment variable. - **accessControlMaxAge** - You can configure the max-age of the Access-Control-Max-Age header. Defaults to 86400 seconds. Overridable with the `ACCESS_CONTROL_MAX_AGE` environment variable. +- **responseTimeWithAppNameKillSwitch** - use this to disable metrics with app names. This is enabled by default but may increase the cardinality of metrics causing Unleash memory usage to grow if your app name is randomly generated (which is not recommended). Overridable with the `UNLEASH_RESPONSE_TIME_WITH_APP_NAME_KILL_SWITCH` environment variable. You can also set the environment variable `ENABLED_ENVIRONMENTS` to a comma delimited string of environment names to override environments.