Skip to content

Commit 896061c

Browse files
authored
fix: tests (#114)
1 parent d2c7bf8 commit 896061c

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/client/index.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,9 @@ describe("workflow client", () => {
234234
"upstash-delay": "1s",
235235
"content-type": "application/json",
236236
"upstash-feature-set": "LazyFetch,InitialBody",
237+
"upstash-telemetry-framework": "unknown",
237238
"upstash-telemetry-runtime": expect.stringMatching(/bun@/),
238-
"upstash-telemetry-sdk": expect.stringMatching(/upstash-qstash-js@/),
239+
"upstash-telemetry-sdk": expect.stringContaining("@upstash/workflow"),
239240
"upstash-workflow-sdk-version": "1",
240241
},
241242
body,
@@ -298,8 +299,9 @@ describe("workflow client", () => {
298299
"upstash-delay": "1s",
299300
"content-type": "application/json",
300301
"upstash-feature-set": "LazyFetch,InitialBody",
302+
"upstash-telemetry-framework": "unknown",
301303
"upstash-telemetry-runtime": expect.stringMatching(/bun@/),
302-
"upstash-telemetry-sdk": expect.stringMatching(/upstash-qstash-js@/),
304+
"upstash-telemetry-sdk": expect.stringContaining("@upstash/workflow"),
303305
"upstash-workflow-sdk-version": "1",
304306
},
305307
body,
@@ -317,8 +319,9 @@ describe("workflow client", () => {
317319
"upstash-delay": "1s",
318320
"content-type": "application/json",
319321
"upstash-feature-set": "LazyFetch,InitialBody",
322+
"upstash-telemetry-framework": "unknown",
320323
"upstash-telemetry-runtime": expect.stringMatching(/bun@/),
321-
"upstash-telemetry-sdk": expect.stringMatching(/upstash-qstash-js@/),
324+
"upstash-telemetry-sdk": expect.stringContaining("@upstash/workflow"),
322325
"upstash-workflow-sdk-version": "1",
323326
"upstash-failure-callback": "https://requestcatcher.com/api",
324327
"upstash-failure-callback-feature-set": "LazyFetch,InitialBody",
@@ -385,8 +388,9 @@ describe("workflow client", () => {
385388
"upstash-failure-callback-workflow-init": "false",
386389
"upstash-failure-callback-workflow-runid": `wfr_${myWorkflowRunId}`,
387390
"upstash-failure-callback-workflow-url": "https://requestcatcher.com/api",
391+
"upstash-telemetry-framework": "unknown",
388392
"upstash-telemetry-runtime": expect.stringMatching(/bun@/),
389-
"upstash-telemetry-sdk": expect.stringMatching(/upstash-qstash-js@/),
393+
"upstash-telemetry-sdk": expect.stringContaining("@upstash/workflow"),
390394
"upstash-workflow-sdk-version": "1",
391395
},
392396
body,

src/client/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { getWorkflowRunId } from "../utils";
55
import { triggerFirstInvocation } from "../workflow-requests";
66
import { WorkflowContext } from "../context";
77
import { TriggerOptions, WorkflowRunLog, WorkflowRunLogs } from "./types";
8+
import { SDK_TELEMETRY } from "../constants";
89

910
type ClientConfig = ConstructorParameters<typeof QStashClient>[0];
1011

@@ -246,14 +247,14 @@ export class Client {
246247
url: option.url,
247248
workflowRunId: finalWorkflowRunId,
248249
retries: option.retries,
249-
telemetry: undefined, // can't know workflow telemetry here
250+
telemetry: { sdk: SDK_TELEMETRY },
250251
flowControl: option.flowControl,
251252
failureUrl,
252253
});
253254

254255
return {
255256
workflowContext: context,
256-
telemetry: undefined, // can't know workflow telemetry here
257+
telemetry: { sdk: SDK_TELEMETRY },
257258
delay: option.delay,
258259
};
259260
});

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export type Telemetry = {
281281
/**
282282
* platform (such as nextjs/cloudflare)
283283
*/
284-
framework: string;
284+
framework?: string;
285285
/**
286286
* node version
287287
*/

src/workflow-requests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export type HeadersResponse = {
427427
export const getTelemetryHeaders = (telemetry: Telemetry) => {
428428
return {
429429
[TELEMETRY_HEADER_SDK]: telemetry.sdk,
430-
[TELEMETRY_HEADER_FRAMEWORK]: telemetry.framework,
430+
[TELEMETRY_HEADER_FRAMEWORK]: telemetry.framework ?? "unknown",
431431
[TELEMETRY_HEADER_RUNTIME]: telemetry.runtime ?? "unknown",
432432
};
433433
};

0 commit comments

Comments
 (0)