@devries-cameron20 / composio Mirror · read-only / commits / b3e9e7db4
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 23, 00:30 UTC

Update telemetry metadata for tracking

haxzie committed Jun 13, 2025 at 19:57 UTC b3e9e7db40e6d25e9d87d8d631261da536033e23
4 files changed +59 -9
packages/core/src/composio.ts
+29 -3
@@ -19,11 +19,39 @@ import { LogLevel } from '@composio/client/client';
19 export type ComposioConfig<
20 TProvider extends BaseComposioProvider<unknown, unknown> = OpenAIProvider,
21 > = {
22 + /**
23 + * The API key for the Composio API.
24 + * @example 'sk-1234567890'
25 + */
26 apiKey?: string | null;
27 + /**
28 + * The base URL of the Composio API.
29 + * @example 'https://backend.composio.dev'
30 + */
31 baseURL?: string | null;
32 + /**
33 + * Whether to allow tracking for the Composio instance.
34 + * @example true, false
35 + * @default true
36 + */
37 allowTracking?: boolean;
38 + /**
39 + * Whether to allow tracing for the Composio instance.
40 + * @example true, false
41 + * @default true
42 + */
43 allowTracing?: boolean;
44 + /**
45 + * The tool provider to use for this Composio instance.
46 + * @example new OpenAIProvider()
47 + */
48 provider?: TProvider;
49 + /**
50 + * The host service name of the SDK where the SDK is running.
51 + * This is used to identify the host for telemetry. Ignore it if you are not using telemetry.
52 + * @example 'mcp', 'apollo', ' etc
53 + */
54 + host?: string;
55 /**
56 * Request options to be passed to the Composio API client.
57 * This is useful for passing in a custom fetch implementation.
@@ -150,13 +178,11 @@ export class Composio<TProvider extends BaseComposioProvider<unknown, unknown> =
178 telemetry.setup({
179 apiKey: apiKeyParsed ?? '',
180 baseUrl: baseURLParsed ?? '',
153 - frameworkRuntime: this.provider?.name ?? 'unknown',
181 isAgentic: this.provider?._isAgentic || false,
155 - source: 'composio-sdk-typescript',
182 version: version,
157 - sdkType: 'Typescript-V3',
183 isBrowser: typeof window !== 'undefined',
184 provider: this.provider?.name ?? 'openai',
185 + host: this.config.host,
186 // @TODO: Users might want to pass their own session id
187 // @TODO: We shouldn't be doing this as people might always have one session id throughout the process in server
188 sessionId: this.config.allowTracing ? getRandomUUID() : undefined, // @TODO: get the session id
packages/core/src/services/telemetry/TelemetryService.types.ts
+4 -1
@@ -1,7 +1,10 @@
1 import { z } from 'zod';
2
3 export const TelemetryMetricSourceSchema = z.object({
4 - name: z.string().describe('The name of the source').optional(),
4 + host: z
5 + .string()
6 + .describe('The host of the service running the SDK, eg: mcp, apollo, etc')
7 + .optional(),
8 service: z
9 .enum(['sdk', 'apollo', 'hermes', 'thermos'])
10 .describe('The service of the source')
packages/core/src/telemetry/Telemetry.ts
+1 -1
@@ -52,7 +52,7 @@ export class TelemetryTransport {
52 this.telemetryMetadata = metadata;
53 this.isTelemetryDisabled = false;
54 this.telemetrySource = {
55 - name: this.telemetrySourceName,
55 + host: this.telemetryMetadata?.host ?? this.telemetrySourceName,
56 service: this.telemetryServiceName,
57 language: this.telemetryLanguage,
58 version: this.telemetryMetadata?.version,
packages/core/src/types/telemetry.types.ts
+25 -4
@@ -11,15 +11,36 @@ export type TelemetryEvent = (typeof TELEMETRY_EVENTS)[keyof typeof TELEMETRY_EV
11 * Metadata for the telemetry.
12 */
13 export type TelemetryMetadata = {
14 + /**
15 + * The API key of the SDK.
16 + * @example 'sk-1234567890'
17 + */
18 apiKey: string;
19 + /**
20 + * The base URL of the SDK.
21 + * @example 'https://api.composio.dev'
22 + */
23 baseUrl: string;
24 + /**
25 + * The version of the SDK.
26 + * @example '1.0.0'
27 + */
28 version: string;
17 - frameworkRuntime: string;
29 + /**
30 + * The host service name of the SDK where the SDK is running.
31 + * @example 'mcp', 'apollo' etc
32 + */
33 + host?: string;
34 + /**
35 + * Whether the SDK is agentic.
36 + * @example true, false
37 + */
38 isAgentic: boolean;
19 - source: string;
39 + /**
40 + * The provider of the SDK.
41 + * @example 'openai', 'anthropic', 'google', 'azure', 'composio'
42 + */
43 provider?: string;
21 - transport?: string;
22 - sdkType?: string;
44 sessionId?: string;
45 isBrowser?: boolean;
46 };