Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: address review comments for PKI telemetry events

Devin AI715a4e714e5e
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index 0c22fdb355..8ca5c2a3a2 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -2686,6 +2686,7 @@ export const registerRoutes = async (
queueService,
cronJob,
pkiSubscriberDAL,
+ projectDAL,
certificateAuthorityDAL,
certificateAuthorityQueue,
certificateDAL,
diff --git a/backend/src/services/pki-subscriber/pki-subscriber-queue.ts b/backend/src/services/pki-subscriber/pki-subscriber-queue.ts
index 97d588dcde..e2ce4efde5 100644
--- a/backend/src/services/pki-subscriber/pki-subscriber-queue.ts
+++ b/backend/src/services/pki-subscriber/pki-subscriber-queue.ts
@@ -9,6 +9,7 @@ import { TCertificateAuthorityDALFactory } from "../certificate-authority/certif
import { CaStatus, CaType } from "../certificate-authority/certificate-authority-enums";
import { TCertificateAuthorityQueueFactory } from "../certificate-authority/certificate-authority-queue";
import { InternalCertificateAuthorityFns } from "../certificate-authority/internal/internal-certificate-authority-fns";
+import { TProjectDALFactory } from "../project/project-dal";
import { TTelemetryServiceFactory } from "../telemetry/telemetry-service";
import { PostHogEventTypes } from "../telemetry/telemetry-types";
import { TPkiSubscriberDALFactory } from "./pki-subscriber-dal";
@@ -18,6 +19,7 @@ type TPkiSubscriberQueueServiceFactoryDep = {
queueService: TQueueServiceFactory;
cronJob: TCronJobFactory;
pkiSubscriberDAL: TPkiSubscriberDALFactory;
+ projectDAL: Pick<TProjectDALFactory, "findById">;
certificateAuthorityDAL: TCertificateAuthorityDALFactory;
certificateAuthorityQueue: TCertificateAuthorityQueueFactory;
internalCaFns: ReturnType<typeof InternalCertificateAuthorityFns>;
@@ -30,6 +32,7 @@ export const pkiSubscriberQueueServiceFactory = ({
queueService,
cronJob,
pkiSubscriberDAL,
+ projectDAL,
certificateAuthorityDAL,
certificateAuthorityQueue,
internalCaFns,
@@ -154,11 +157,13 @@ export const pkiSubscriberQueueServiceFactory = ({
lastOperationAt: new Date()
});
+ const project = await projectDAL.findById(subscriber.projectId);
await telemetryService.sendPostHogEvents({
event: PostHogEventTypes.CertificateAutoRenewalFailed,
distinctId: `platform/${subscriber.projectId}`,
+ organizationId: project.orgId,
properties: {
- orgId: subscriber.projectId
+ orgId: project.orgId
}
});
}
diff --git a/backend/src/services/pki-sync/pki-sync-queue.ts b/backend/src/services/pki-sync/pki-sync-queue.ts
index cd82629bfe..51ba996619 100644
--- a/backend/src/services/pki-sync/pki-sync-queue.ts
+++ b/backend/src/services/pki-sync/pki-sync-queue.ts
@@ -593,18 +593,18 @@ export const pkiSyncQueueFactory = ({
lastSyncMessage: syncMessage,
lastSyncedAt: isSynced ? ranAt : undefined
});
- }
- await telemetryService.sendPostHogEvents({
- event: PostHogEventTypes.PkiSyncExecuted,
- distinctId: `platform/${pkiSync.projectId}`,
- organizationId: pkiSync.connection.orgId,
- properties: {
- orgId: pkiSync.connection.orgId,
- destination: pkiSync.destination,
- success: isSynced
- }
- });
+ await telemetryService.sendPostHogEvents({
+ event: PostHogEventTypes.PkiSyncExecuted,
+ distinctId: `platform/${pkiSync.projectId}`,
+ organizationId: pkiSync.connection.orgId,
+ properties: {
+ orgId: pkiSync.connection.orgId,
+ destination: pkiSync.destination,
+ success: isSynced
+ }
+ });
+ }
}
};