@devries-cameron20 / composio-1 / commits / f7fe62b4e
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Fix issues with sending telemetry

haxzie committed May 21, 2025 at 19:09 UTC f7fe62b4e41c8ebd1461397662f20f0d24dd2265
2 files changed +17 -5
examples/telemetry/package.json
+1 -1
@@ -5,7 +5,7 @@
5 "description": "",
6 "main": "src/index.ts",
7 "scripts": {
8 - "start": "COMPOSIO_LOG_LEVEL=debug bun src/index.ts",
8 + "start": "COMPOSIO_LOG_LEVEL=debug NODE_ENV=test bun src/index.ts",
9 "test": "echo \"Error: no test specified\" && exit 1"
10 },
11 "keywords": [],
packages/core/src/telemetry/Telemetry.ts
+16 -4
@@ -119,16 +119,28 @@ export class TelemetryService {
119 return instance;
120 }
121
122 + /**
123 + * Check if the telemetry should be sent.
124 + * @returns true if the telemetry should be sent, false otherwise
125 + */
126 + private shouldSendTelemetry() {
127 + const devEnvironments = ['test', 'development', 'CI'];
128 + const nodeEnv = (getEnvVariable('NODE_ENV', 'development') || '').toLowerCase();
129 + const isDevEnvironment = devEnvironments.includes(nodeEnv);
130 + const isTelemetryDisabledByEnv = getEnvVariable('TELEMETRY_DISABLED', 'false') === 'true';
131 +
132 + return (
133 + this.transport && !this.isTelemetryDisabled && !isTelemetryDisabledByEnv && !isDevEnvironment
134 + );
135 + }
136 +
137 /**
138 * Send the telemetry payload to the server.
139 * @param payload - the telemetry payload to send
140 * @returns
141 */
142 async sendTelemetry(payload: TelemetryPayload[]) {
128 - const isTelemetryDisabled =
129 - this.isTelemetryDisabled || getEnvVariable('TELEMETRY_DISABLED', 'false') === 'true';
130 -
131 - if (!this.transport || isTelemetryDisabled) {
143 + if (!this.shouldSendTelemetry()) {
144 return;
145 }
146