mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-07 22:53:55 -05:00
misc: added env-based flag for enabling telemetry
This commit is contained in:
@@ -64,4 +64,5 @@ CLIENT_SECRET_GITHUB_LOGIN=
|
||||
CLIENT_ID_GITLAB_LOGIN=
|
||||
CLIENT_SECRET_GITLAB_LOGIN=
|
||||
|
||||
OTEL_COLLECTOR_OTLP_URL=
|
||||
OTEL_COLLECTOR_OTLP_URL=
|
||||
OTEL_TELEMETRY_COLLECTION_ENABLED=
|
||||
|
||||
@@ -120,6 +120,7 @@ const envSchema = z
|
||||
.optional(),
|
||||
INFISICAL_CLOUD: zodStrBool.default("false"),
|
||||
MAINTENANCE_MODE: zodStrBool.default("false"),
|
||||
OTEL_TELEMETRY_COLLECTION_ENABLED: zodStrBool.default("false"),
|
||||
OTEL_COLLECTOR_OTLP_URL: zpStr(z.string().optional())
|
||||
})
|
||||
.transform((data) => ({
|
||||
|
||||
@@ -15,7 +15,9 @@ const run = async () => {
|
||||
const logger = await initLogger();
|
||||
const appCfg = initEnvConfig(logger);
|
||||
|
||||
await initTelemetry({ otlpURL: appCfg.OTEL_COLLECTOR_OTLP_URL });
|
||||
if (appCfg.OTEL_TELEMETRY_COLLECTION_ENABLED) {
|
||||
await initTelemetry({ otlpURL: appCfg.OTEL_COLLECTOR_OTLP_URL });
|
||||
}
|
||||
|
||||
const db = initDbConnection({
|
||||
dbConnectionUri: appCfg.DB_CONNECTION_URI,
|
||||
|
||||
@@ -63,7 +63,11 @@ export const main = async ({ db, smtp, logger, queue, keyStore }: TMain) => {
|
||||
});
|
||||
// pull ip based on various proxy headers
|
||||
await server.register(fastifyIp);
|
||||
await server.register(apiMetrics);
|
||||
|
||||
if (appCfg.OTEL_TELEMETRY_COLLECTION_ENABLED) {
|
||||
await server.register(apiMetrics);
|
||||
}
|
||||
|
||||
await server.register(fastifySwagger);
|
||||
await server.register(fastifyFormBody);
|
||||
await server.register(fastifyErrHandler);
|
||||
|
||||
Reference in New Issue
Block a user