From a7b3d128446e0aa51cb98d36c9d0772206c9ec69 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Thu, 31 Aug 2023 20:58:07 -0400 Subject: [PATCH] only capture non sign up secret events --- backend/src/helpers/secrets.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/helpers/secrets.ts b/backend/src/helpers/secrets.ts index e8c3419ba..ad6296adf 100644 --- a/backend/src/helpers/secrets.ts +++ b/backend/src/helpers/secrets.ts @@ -509,7 +509,7 @@ export const getSecretsHelper = async ({ throw UnauthorizedRequestError({ message: "Folder Permission Denied" }); } } - + if (!folderId) { folderId = await getFolderIdFromServiceToken(workspaceId, environment, secretPath); } @@ -583,7 +583,10 @@ export const getSecretsHelper = async ({ } } - if (postHogClient) { + const numberOfSignupSecrets = (secrets.filter((secret) => secret?.metadata?.source === "signup")).length; + const atLeastOneNonSignUpSecret = (secrets.length - numberOfSignupSecrets > 0) + + if (postHogClient && atLeastOneNonSignUpSecret) { const shouldCapture = authData.userAgent !== K8_USER_AGENT_NAME || shouldRecordK8Event; const approximateForNoneCapturedEvents = secrets.length * 10