mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
set posthog flush to zero and fix typos
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,7 +111,7 @@ export type TTelemetryInstanceStatsEvent = {
|
||||
secrets: number;
|
||||
organizations: number;
|
||||
organizationNames: number;
|
||||
numberOfSecretOperations: number;
|
||||
numberOfSecretOperationsMade: number;
|
||||
numberOfSecretProcessed: number;
|
||||
};
|
||||
};
|
||||
|
||||
2
frontend/package-lock.json
generated
2
frontend/package-lock.json
generated
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "npm-proj-1708687711895-0.8280111363176879xoEiUg",
|
||||
"name": "frontend",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
Reference in New Issue
Block a user