Skip to content

Commit

Permalink
chore: GA responseTimeWithAppNames (#3178)
Browse files Browse the repository at this point in the history
## About the changes
This makes response time with app names enabled for everyone but also
kept a way of turning it off (kill switch) in case it cause some issues
because of misconfigured app names
  • Loading branch information
Gastón Fournier committed Feb 22, 2023
1 parent 613babd commit 4e3ce8e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/__snapshots__/create-config.test.ts.snap
Expand Up @@ -81,7 +81,7 @@ exports[`should create default config 1`] = `
"notifications": false,
"projectStatusApi": false,
"proxyReturnAllToggles": false,
"responseTimeWithAppName": false,
"responseTimeWithAppNameKillSwitch": false,
"showProjectApiAccess": false,
"strictSchemaValidation": false,
},
Expand All @@ -102,7 +102,7 @@ exports[`should create default config 1`] = `
"notifications": false,
"projectStatusApi": false,
"proxyReturnAllToggles": false,
"responseTimeWithAppName": false,
"responseTimeWithAppNameKillSwitch": false,
"showProjectApiAccess": false,
"strictSchemaValidation": false,
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/middleware/response-time-metrics.ts
Expand Up @@ -20,7 +20,7 @@ export function responseTimeMetrics(

let appName;
if (
flagResolver.isEnabled('responseTimeWithAppName') &&
!flagResolver.isEnabled('responseTimeWithAppNameKillSwitch') &&
(instanceStatsService.getAppCountSnapshot('7d') ??
appNameReportingThreshold) < appNameReportingThreshold
) {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/types/experimental.ts
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/server-dev.ts
Expand Up @@ -37,7 +37,7 @@ process.nextTick(async () => {
embedProxy: true,
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppName: true,
responseTimeWithAppNameKillSwitch: false,
maintenance: true,
featuresExportImport: true,
newProjectOverview: true,
Expand Down
1 change: 1 addition & 0 deletions website/docs/reference/deploy/configuring-unleash.md
Expand Up @@ -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.

Expand Down

0 comments on commit 4e3ce8e

Please sign in to comment.