shared env var to disable telemetry in cli and webapp
This commit is contained in:
@@ -37,6 +37,7 @@ const EnvironmentSchema = z.object({
|
||||
POSTHOG_PROJECT_KEY: z.string().optional(),
|
||||
TELEMETRY_TRIGGER_API_KEY: z.string().optional(),
|
||||
TELEMETRY_TRIGGER_API_URL: z.string().optional(),
|
||||
TRIGGER_TELEMETRY_DISABLED: z.string().optional(),
|
||||
HIGHLIGHT_PROJECT_ID: z.string().optional(),
|
||||
AUTH_GITHUB_CLIENT_ID: z.string().optional(),
|
||||
AUTH_GITHUB_CLIENT_SECRET: z.string().optional(),
|
||||
|
||||
@@ -21,6 +21,11 @@ class Telemetry {
|
||||
#triggerClient: TriggerClient | undefined = undefined;
|
||||
|
||||
constructor({ postHogApiKey, trigger }: Options) {
|
||||
if (env.TRIGGER_TELEMETRY_DISABLED !== undefined) {
|
||||
console.log("📉 Telemetry disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
if (postHogApiKey) {
|
||||
this.#posthogClient = new PostHog(postHogApiKey, { host: "https://eu.posthog.com" });
|
||||
} else {
|
||||
|
||||
@@ -9,9 +9,15 @@ import {
|
||||
SEMRESATTRS_SERVICE_NAME,
|
||||
SEMRESATTRS_SERVICE_VERSION,
|
||||
} from "@opentelemetry/semantic-conventions";
|
||||
import { logger } from "../utilities/logger";
|
||||
|
||||
function initializeTracing(): NodeTracerProvider | undefined {
|
||||
if (process.argv.includes("--skip-telemetry") || process.env.TRIGGER_DEV_SKIP_TELEMETRY) {
|
||||
if (
|
||||
process.argv.includes("--skip-telemetry") ||
|
||||
process.env.TRIGGER_DEV_SKIP_TELEMETRY || // only for backwards compat
|
||||
process.env.TRIGGER_TELEMETRY_DISABLED
|
||||
) {
|
||||
logger.debug("📉 Telemetry disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user