@devries-cameron20 / composio Mirror · read-only / commits / 686563976
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, 04:15 UTC

Add global error telemetry

haxzie committed Apr 17, 2025 at 16:21 UTC 686563976f5057cd7ff4117a518f2bbffe2fda53
3 files changed +25 -7
README.md
+6 -6
@@ -45,14 +45,14 @@ pnpm run create-toolset langchain
45
46 ## Internal
47 What's not included from @composio/client
48 -- [ ] Zod Schemas for type checking
48 +- [X] Org/Project Mangement with API Keys
49 +- [X] Trigger Subscriptions
50 +- [ ] Zod Schemas for type checking `Ideally strike a minimal balance, since backend has most`
51 - [ ] Action Execution
50 -- [ ] Org/Project Mangement with API Keys
51 -- [ ] CLI
52 -- [ ] MCP
53 -- [ ] Team Members
52 +- [ ] CLI `Do we need this in the core SDK?`
53 +- [ ] MCP `Not required as this is not necessary`
54 +- [ ] Team Members
55 - [ ] File uploads/user files
55 -- [ ] Trigger Subscriptions
56 - [ ] Tests
57
58 These models can be still be accessed via the SDK explicitly by using the `@composio/client`.
\ No newline at end of file
packages/core/src/telemetry/Telemetry.ts
+18 -1
@@ -88,7 +88,24 @@ export class Telemetry<U extends InstrumentedInstance> {
88
89 console.log("telemetryPayload", telemetryPayload);
90
91 - return await originalMethod.apply(instance, args);
91 + // @TODO: Add a try catch here to create global error handler
92 + try {
93 +
94 + return await originalMethod.apply(instance, args);
95 + } catch (error) {
96 + const telemetryPayload: TelemetryPayload = {
97 + eventName: TELEMETRY_EVENTS.SDK_METHOD_ERROR,
98 + data: {
99 + fileName: instance.FILE_NAME ?? fileName ?? "unknown",
100 + method: name,
101 + params: args,
102 + error: error,
103 + },
104 + sdk_meta: this.telemetryMetadata,
105 + }
106 + this.batchProcessor.pushItem(telemetryPayload);
107 + throw error;
108 + }
109 };
110 }
111
packages/core/src/types/telemetry.types.ts
+1
@@ -2,6 +2,7 @@
2 export const TELEMETRY_EVENTS = {
3 SDK_INITIALIZED: "SDK_INITIALIZED",
4 SDK_METHOD_INVOKED: "SDK_METHOD_INVOKED",
5 + SDK_METHOD_ERROR: "SDK_METHOD_ERROR",
6 CLI_INVOKED: "CLI_INVOKED",
7 } as const;
8