Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: add deployment_type, instance_type, and region to PostHog telemetry
Devin AI99f4c923709c
diff --git a/backend/src/services/telemetry/telemetry-service.ts b/backend/src/services/telemetry/telemetry-service.tsindex 0531ed60f8..73f6302202 100644--- a/backend/src/services/telemetry/telemetry-service.ts+++ b/backend/src/services/telemetry/telemetry-service.ts@@ -62,6 +62,30 @@ export const createTelemetryEventKey = (event: string, distinctId: string): strireturn `telemetry-event-${event}-${bucketId}-${distinctId}-${crypto.nativeCrypto.randomUUID()}`;};+export enum DeploymentType {+ USCloud = "us-cloud",+ EUCloud = "eu-cloud",+ Dedicated = "dedicated",+ SelfHosted = "self-hosted"+}++/**+ * Computes the deployment type based on the instance type and environment configuration.+ * - US Cloud: instanceType is Cloud and INTERNAL_REGION is "us" (or unset, defaults to US)+ * - EU Cloud: instanceType is Cloud and INTERNAL_REGION is "eu"+ * - Dedicated: INFISICAL_CLOUD is true but instanceType is not Cloud (uses self-hosted license keys)+ * - Self-Hosted: everything else+ */+const getDeploymentType = (instanceType: InstanceType, appConfig: { INFISICAL_CLOUD: boolean; INTERNAL_REGION?: string }) => {+ if (instanceType === InstanceType.Cloud) {+ return appConfig.INTERNAL_REGION === "eu" ? DeploymentType.EUCloud : DeploymentType.USCloud;+ }+ if (appConfig.INFISICAL_CLOUD) {+ return DeploymentType.Dedicated;+ }+ return DeploymentType.SelfHosted;+};+export const telemetryServiceFactory = ({ keyStore, licenseService, orgDAL }: TTelemetryServiceFactoryDep) => {const appCfg = getConfig();@@ -160,6 +184,11 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environmeconst instanceType = licenseService.getInstanceType();properties.is_cloud = instanceType === InstanceType.Cloud;+ properties.instance_type = instanceType;+ properties.deployment_type = getDeploymentType(instanceType, appCfg);+ if (appCfg.INTERNAL_REGION) {+ properties.region = appCfg.INTERNAL_REGION;+ }try {const org = await orgDAL.findOrgById(orgId);