Skip to content

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

set posthog flush to zero and fix typos

Maidul Islamd6cde4818146
diff --git a/backend/src/services/telemetry/telemetry-queue.ts b/backend/src/services/telemetry/telemetry-queue.ts
index 1b855e6bb3..02e906fe69 100644
--- a/backend/src/services/telemetry/telemetry-queue.ts
+++ b/backend/src/services/telemetry/telemetry-queue.ts
@@ -7,7 +7,7 @@ import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";
import { getServerCfg } from "../super-admin/super-admin-service";
import { TTelemetryDALFactory } from "./telemetry-dal";
-import { TELEMETRY_SECRET_OPERATONS_KEY, TELEMETRY_SECRET_PROCESSED_KEY } from "./telemetry-service";
+import { TELEMETRY_SECRET_OPERATIONS_KEY, TELEMETRY_SECRET_PROCESSED_KEY } from "./telemetry-service";
import { PostHogEventTypes } from "./telemetry-types";
type TTelemetryQueueServiceFactoryDep = {
@@ -26,16 +26,16 @@ export const telemetryQueueServiceFactory = ({
const appCfg = getConfig();
const postHog =
appCfg.isProductionMode && appCfg.TELEMETRY_ENABLED
- ? new PostHog(appCfg.POSTHOG_PROJECT_API_KEY, { host: appCfg.POSTHOG_HOST })
+ ? new PostHog(appCfg.POSTHOG_PROJECT_API_KEY, { host: appCfg.POSTHOG_HOST, flushAt: 1, flushInterval: 0 })
: undefined;
queueService.start(QueueName.TelemetryInstanceStats, async () => {
const { instanceId } = await getServerCfg();
const telemtryStats = await telemetryDAL.getTelemetryInstanceStats();
// parse the redis values into integer
- const numberOfSecretOperations = parseInt((await keyStore.getItem(TELEMETRY_SECRET_OPERATONS_KEY)) || "0", 10);
+ const numberOfSecretOperationsMade = parseInt((await keyStore.getItem(TELEMETRY_SECRET_OPERATIONS_KEY)) || "0", 10);
const numberOfSecretProcessed = parseInt((await keyStore.getItem(TELEMETRY_SECRET_PROCESSED_KEY)) || "0", 10);
- const stats = { ...telemtryStats, numberOfSecretProcessed, numberOfSecretOperations };
+ const stats = { ...telemtryStats, numberOfSecretProcessed, numberOfSecretOperationsMade };
// send to postHog
postHog?.capture({
@@ -45,7 +45,7 @@ export const telemetryQueueServiceFactory = ({
});
// reset the stats
await keyStore.deleteItem(TELEMETRY_SECRET_PROCESSED_KEY);
- await keyStore.deleteItem(TELEMETRY_SECRET_OPERATONS_KEY);
+ await keyStore.deleteItem(TELEMETRY_SECRET_OPERATIONS_KEY);
});
// every day at midnight a telemetry job executes on self hosted
diff --git a/backend/src/services/telemetry/telemetry-service.ts b/backend/src/services/telemetry/telemetry-service.ts
index ebaa614448..9912e0101c 100644
--- a/backend/src/services/telemetry/telemetry-service.ts
+++ b/backend/src/services/telemetry/telemetry-service.ts
@@ -9,8 +9,8 @@ import { logger } from "@app/lib/logger";
import { PostHogEventTypes, TPostHogEvent, TSecretModifiedEvent } from "./telemetry-types";
-export const TELEMETRY_SECRET_PROCESSED_KEY = "telemtry-secret-processed";
-export const TELEMETRY_SECRET_OPERATONS_KEY = "telemtry-secret-operations";
+export const TELEMETRY_SECRET_PROCESSED_KEY = "telemetry-secret-processed";
+export const TELEMETRY_SECRET_OPERATIONS_KEY = "telemetry-secret-operations";
export type TTelemetryServiceFactory = ReturnType<typeof telemetryServiceFactory>;
export type TTelemetryServiceFactoryDep = {
@@ -30,10 +30,9 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
`);
}
- const postHog =
- appCfg.isProductionMode && appCfg.TELEMETRY_ENABLED
- ? new PostHog(appCfg.POSTHOG_PROJECT_API_KEY, { host: appCfg.POSTHOG_HOST })
- : undefined;
+ const postHog = appCfg.TELEMETRY_ENABLED
+ ? new PostHog(appCfg.POSTHOG_PROJECT_API_KEY, { host: appCfg.POSTHOG_HOST })
+ : undefined;
// used for email marketting email sending purpose
const sendLoopsEvent = async (email: string, firstName?: string, lastName?: string) => {
@@ -85,7 +84,7 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
TELEMETRY_SECRET_PROCESSED_KEY,
(event as TSecretModifiedEvent).properties.numberOfSecrets
);
- await keyStore.incrementBy(TELEMETRY_SECRET_OPERATONS_KEY, 1);
+ await keyStore.incrementBy(TELEMETRY_SECRET_OPERATIONS_KEY, 1);
}
}
};
diff --git a/backend/src/services/telemetry/telemetry-types.ts b/backend/src/services/telemetry/telemetry-types.ts
index 9feb56b14f..947403783b 100644
--- a/backend/src/services/telemetry/telemetry-types.ts
+++ b/backend/src/services/telemetry/telemetry-types.ts
@@ -111,7 +111,7 @@ export type TTelemetryInstanceStatsEvent = {
secrets: number;
organizations: number;
organizationNames: number;
- numberOfSecretOperations: number;
+ numberOfSecretOperationsMade: number;
numberOfSecretProcessed: number;
};
};
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 0ab91f92f3..458d4e1150 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "npm-proj-1708687711895-0.8280111363176879xoEiUg",
+ "name": "frontend",
"lockfileVersion": 3,
"requires": true,
"packages": {