From 205aeb52656806c95c15aff575a8ea9c8fb5a8cb Mon Sep 17 00:00:00 2001 From: David Leek Date: Mon, 19 Aug 2024 14:16:31 +0200 Subject: [PATCH] feat: feature flags for metrics and service name logging (#7916) --- src/lib/__snapshots__/create-config.test.ts.snap | 2 ++ src/lib/types/experimental.ts | 12 +++++++++++- src/server-dev.ts | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 2a486bd5cd..bb7233be40 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -72,6 +72,7 @@ exports[`should create default config 1`] = ` "feedbackUriPath": undefined, "flagResolver": FlagResolver { "experiments": { + "addonUsageMetrics": false, "adminTokenKillSwitch": false, "anonymiseEventLog": false, "anonymizeProjectOwners": false, @@ -153,6 +154,7 @@ exports[`should create default config 1`] = ` "useMemoizedActiveTokens": false, "useProjectReadModel": false, "userAccessUIEnabled": false, + "webhookServiceNameLogging": false, }, "externalResolver": { "getVariant": [Function], diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 86ae88e90b..6404acd269 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -66,7 +66,9 @@ export type IFlagKey = | 'changeRequestPlayground' | 'archiveProjects' | 'projectListImprovements' - | 'useProjectReadModel'; + | 'useProjectReadModel' + | 'webhookServiceNameLogging' + | 'addonUsageMetrics'; export type IFlags = Partial<{ [key in IFlagKey]: boolean | Variant }>; @@ -323,6 +325,14 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_USE_PROJECT_READ_MODEL, false, ), + webhookServiceNameLogging: parseEnvVarBoolean( + process.env.UNLEASH_EXPERIMENTAL_WEBHOOK_SERVICE_NAME_LOGGING, + false, + ), + addonUsageMetrics: parseEnvVarBoolean( + process.env.UNLEASH_EXPERIMENTAL_ADDON_USAGE_METRICS, + false, + ), }; export const defaultExperimentalOptions: IExperimentalOptions = { diff --git a/src/server-dev.ts b/src/server-dev.ts index a9ed250c35..61b61088e2 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -59,6 +59,8 @@ process.nextTick(async () => { changeRequestPlayground: true, projectListImprovements: true, useProjectReadModel: true, + webhookServiceNameLogging: true, + addonUsageMetrics: true, }, }, authentication: {