From c476f2a02a44590d6b56022a70eaf88684e18ad8 Mon Sep 17 00:00:00 2001 From: Brian Li Date: Tue, 28 Nov 2023 13:00:11 -0500 Subject: [PATCH 1/2] wrap oncall functions with trace context --- src/v2/providers/https.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/v2/providers/https.ts b/src/v2/providers/https.ts index 466160d62..178ee929a 100644 --- a/src/v2/providers/https.ts +++ b/src/v2/providers/https.ts @@ -366,7 +366,7 @@ export function onCall>( // onCallHandler sniffs the function length to determine which API to present. // fix the length to prevent api versions from being mismatched. const fixedLen = (req: CallableRequest) => handler(req); - const func: any = onCallHandler( + let func: any = onCallHandler( { cors: { origin, methods: "POST" }, enforceAppCheck: opts.enforceAppCheck ?? options.getGlobalOptions().enforceAppCheck, @@ -375,6 +375,8 @@ export function onCall>( fixedLen ); + func = wrapTraceContext(func); + Object.defineProperty(func, "__trigger", { get: () => { const baseOpts = options.optionsToTriggerAnnotations(options.getGlobalOptions()); From 55c7223be6c2c578516a5ef660f0a0ea7c08bb3f Mon Sep 17 00:00:00 2001 From: Brian Li Date: Tue, 28 Nov 2023 13:02:59 -0500 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29bb..35533aa31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1 @@ +- Wrap 2nd gen onCall functions with trace context. (#1491)