mirror of
https://github.com/Infisical/infisical.git
synced 2026-01-08 23:18:05 -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_ID_GITLAB_LOGIN=
|
||||||
CLIENT_SECRET_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(),
|
.optional(),
|
||||||
INFISICAL_CLOUD: zodStrBool.default("false"),
|
INFISICAL_CLOUD: zodStrBool.default("false"),
|
||||||
MAINTENANCE_MODE: zodStrBool.default("false"),
|
MAINTENANCE_MODE: zodStrBool.default("false"),
|
||||||
|
OTEL_TELEMETRY_COLLECTION_ENABLED: zodStrBool.default("false"),
|
||||||
OTEL_COLLECTOR_OTLP_URL: zpStr(z.string().optional())
|
OTEL_COLLECTOR_OTLP_URL: zpStr(z.string().optional())
|
||||||
})
|
})
|
||||||
.transform((data) => ({
|
.transform((data) => ({
|
||||||
|
|||||||
@@ -15,7 +15,9 @@ const run = async () => {
|
|||||||
const logger = await initLogger();
|
const logger = await initLogger();
|
||||||
const appCfg = initEnvConfig(logger);
|
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({
|
const db = initDbConnection({
|
||||||
dbConnectionUri: appCfg.DB_CONNECTION_URI,
|
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
|
// pull ip based on various proxy headers
|
||||||
await server.register(fastifyIp);
|
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(fastifySwagger);
|
||||||
await server.register(fastifyFormBody);
|
await server.register(fastifyFormBody);
|
||||||
await server.register(fastifyErrHandler);
|
await server.register(fastifyErrHandler);
|
||||||
|
|||||||
Reference in New Issue
Block a user