Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 20:45 UTC
Fix: Disable complete telemetry when flags are passed (#1853)
Musthaq Ahamad committed
Aug 18, 2025 at 12:57 UTC
b4b8b9445bf563c8ee9a9d2fb01522046dfb81b3
4 files changed
+39
-20
.changeset/few-tigers-give.md
new
+13
@@ -0,0 +1,13 @@
1
+---
2
+'@composio/core': patch
3
+'@composio/anthropic': patch
4
+'@composio/cloudflare': patch
5
+'@composio/google': patch
6
+'@composio/langchain': patch
7
+'@composio/mastra': patch
8
+'@composio/openai': patch
9
+'@composio/openai-agents': patch
10
+'@composio/vercel': patch
11
+---
12
+
13
+Fix telemetry flags and disable when passed
ts/packages/core/src/composio.ts
+1
@@ -203,6 +203,7 @@ export class Composio<
203
host: this.config.host,
204
});
205
}
206
+ // instrument the composio instance
207
telemetry.instrument(this);
208
// instrument the provider since we are not using the provider class directly
209
telemetry.instrument(this.provider);
ts/packages/core/src/telemetry/Telemetry.ts
+23
-17
@@ -104,23 +104,26 @@ export class TelemetryTransport {
104
) => Promise<unknown>;
105
106
(instance as unknown as Record<string, Function>)[name] = async (...args: unknown[]) => {
107
- const telemetryPayload: TelemetryPayload = {
108
- functionName: `${instrumentedClassName}.${name}`,
109
- durationMs: 0,
110
- timestamp: Date.now() / 1000,
111
- props: {
112
- fileName: instrumentedClassName,
113
- method: name,
114
- params: args,
115
- },
116
- metadata: {
117
- provider: this.telemetryMetadata?.provider ?? 'openai',
118
- },
119
- error: undefined,
120
- source: this.telemetrySource,
121
- };
107
+ // Only collect telemetry if setup() has been called (telemetry is enabled)
108
+ if (this.shouldSendTelemetry()) {
109
+ const telemetryPayload: TelemetryPayload = {
110
+ functionName: `${instrumentedClassName}.${name}`,
111
+ durationMs: 0,
112
+ timestamp: Date.now() / 1000,
113
+ props: {
114
+ fileName: instrumentedClassName,
115
+ method: name,
116
+ params: args,
117
+ },
118
+ metadata: {
119
+ provider: this.telemetryMetadata?.provider ?? 'openai',
120
+ },
121
+ error: undefined,
122
+ source: this.telemetrySource,
123
+ };
124
123
- this.batchProcessor.pushItem(telemetryPayload);
125
+ this.batchProcessor.pushItem(telemetryPayload);
126
+ }
127
128
try {
129
return await originalMethod.apply(instance, args);
@@ -128,7 +131,10 @@ export class TelemetryTransport {
131
if (error instanceof Error) {
132
if (!error.errorId) {
133
error.errorId = getRandomUUID();
131
- await this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args);
134
+ // Only send error telemetry if telemetry is enabled
135
+ if (this.shouldSendTelemetry()) {
136
+ await this.prepareAndSendErrorTelemetry(error, instrumentedClassName, name, args);
137
+ }
138
}
139
}
140
throw error;
ts/packages/core/test/telemetry/TelemetryService.test.ts
+2
-3
@@ -16,7 +16,7 @@ const createPayload = (overrides: Partial<TelemetryPayload> = {}): TelemetryPayl
16
timestamp: Date.now() / 1000,
17
props: { foo: 'bar' },
18
source: {
19
- name: 'test',
19
+ host: 'test-host',
20
service: 'sdk',
21
language: 'typescript',
22
version: '1.0.0',
@@ -75,9 +75,8 @@ describe('TelemetryTransport', () => {
75
apiKey: 'test-key',
76
baseUrl: 'http://localhost',
77
version: '1.0.0',
78
- frameworkRuntime: 'node',
78
isAgentic: false,
80
- source: 'test-source',
79
+ host: 'test-host',
80
provider: 'test',
81
};
82