MCPcopy Index your code
hub / github.com/CopilotKit/CopilotKit / send

Function send

packages/shared/src/telemetry/lambda-client.ts:112–151  ·  view source on GitHub ↗
(opts: LambdaSendOptions)

Source from the content-addressed store, hash-verified

110}
111
112export async function send(opts: LambdaSendOptions): Promise<void> {
113 try {
114 const body = JSON.stringify({
115 event: opts.event,
116 properties: stripCloudKeys(opts.properties),
117 global_properties: stripCloudKeys(opts.globalProperties),
118 package: {
119 name: opts.packageName,
120 version: opts.packageVersion,
121 },
122 ts: Math.floor(Date.now() / 1000),
123 });
124
125 const telemetryId = parseTelemetryIdFromLicense(opts.licenseToken);
126 const headers: Record<string, string> = {
127 "Content-Type": "application/json",
128 "User-Agent": opts.packageName
129 ? `CopilotKit-Runtime/${opts.packageVersion ?? "unknown"} (${opts.packageName})`
130 : "CopilotKit-Runtime",
131 };
132 if (telemetryId) {
133 headers["X-CopilotKit-Telemetry-Id"] = telemetryId;
134 }
135
136 const controller = new AbortController();
137 const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
138 try {
139 await fetch(TELEMETRY_SINK_URL, {
140 method: "POST",
141 headers,
142 body,
143 signal: controller.signal,
144 });
145 } finally {
146 clearTimeout(timeoutId);
147 }
148 } catch {
149 // Silent failure — telemetry must not break the application.
150 }
151}
152
153export const lambdaClient = { send };

Callers 2

Calls 4

stripCloudKeysFunction · 0.85
fetchFunction · 0.85
nowMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…