Skip to content

Commit

Permalink
fix: contenxt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu-dixit committed Dec 11, 2024
1 parent 6ca47e3 commit 0f84c29
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
6 changes: 3 additions & 3 deletions js/src/sdk/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export class CEG {
}

throw new ComposioError(
SDK_ERROR_CODES.COMMON.UNKNOWN,
error.message,
"",
SDK_ERROR_CODES.BACKEND.SERVER_UNREACHABLE,
error.message || "Server is unreachable. Please contact tech@composio.dev with the error details.",
"Server is unreachable. Please contact tech@composio.dev with the error details.",
"Please contact tech@composio.dev with the error details.",
metadata,
error
Expand Down
1 change: 1 addition & 0 deletions js/src/sdk/utils/errors/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const SDK_ERROR_CODES = {
UNAUTHORIZED: "BACKEND::UNAUTHORIZED",
SERVER_ERROR: "BACKEND::SERVER_ERROR",
SERVER_UNAVAILABLE: "BACKEND::SERVER_UNAVAILABLE",
SERVER_UNREACHABLE: "BACKEND::SERVER_UNREACHABLE",
UNKNOWN: "BACKEND::UNKNOWN",
},
COMMON: {
Expand Down
20 changes: 17 additions & 3 deletions js/src/sdk/utils/telemetry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { getEnvVariable } from "../../../utils/shared";

export class TELEMETRY_LOGGER {
private static batchProcessor = new BatchProcessor(
1000,
100,
10,
async (data) => {
await TELEMETRY_LOGGER.sendTelemetry(data as Record<string, unknown>[]);
}
Expand All @@ -18,7 +18,14 @@ export class TELEMETRY_LOGGER {
const payload = {
eventName: method.name,
data: { className, args },
sdk_meta: ComposioSDKContext,
sdk_meta: {
apiKey: ComposioSDKContext.apiKey,
baseURL: ComposioSDKContext.baseURL,
composioVersion: ComposioSDKContext.composioVersion,
frameworkRuntime: ComposioSDKContext.frameworkRuntime,
source: ComposioSDKContext.source,
isBrowser: typeof window !== "undefined",
},
};

TELEMETRY_LOGGER.batchProcessor.pushItem(payload);
Expand Down Expand Up @@ -61,7 +68,14 @@ export class TELEMETRY_LOGGER {
const payload = {
eventName,
data,
sdk_meta: ComposioSDKContext,
sdk_meta: {
apiKey: ComposioSDKContext.apiKey,
baseURL: ComposioSDKContext.baseURL,
composioVersion: ComposioSDKContext.composioVersion,
frameworkRuntime: ComposioSDKContext.frameworkRuntime,
source: ComposioSDKContext.source,
isBrowser: typeof window !== "undefined",
},
};
TELEMETRY_LOGGER.batchProcessor.pushItem(payload);
}
Expand Down

0 comments on commit 0f84c29

Please sign in to comment.