Skip to content

Commit 09f5d8a

Browse files
committed
telemetry for function-testing-helpers usage tracking
1 parent 39f4105 commit 09f5d8a

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

packages/app/src/cli/commands/app/function/run.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {globalFlags, jsonFlag} from '@shopify/cli-kit/node/cli'
77
import {Flags} from '@oclif/core'
88
import {renderAutocompletePrompt, isTTY} from '@shopify/cli-kit/node/ui'
99
import {outputDebug} from '@shopify/cli-kit/node/output'
10+
import {addPublicMetadata} from '@shopify/cli-kit/node/metadata'
1011

1112
const DEFAULT_FUNCTION_EXPORT = '_start'
1213

@@ -33,11 +34,24 @@ export default class FunctionRun extends AppUnlinkedCommand {
3334
description: 'Name of the WebAssembly export to invoke.',
3435
env: 'SHOPIFY_FLAG_EXPORT',
3536
}),
37+
'invoked-by': Flags.string({
38+
hidden: true,
39+
description: 'Internal flag to track which client invoked this command.',
40+
env: 'SHOPIFY_FLAG_INVOKED_BY',
41+
}),
3642
}
3743

3844
public async run(): Promise<AppUnlinkedCommandOutput> {
3945
const {flags} = await this.parse(FunctionRun)
4046

47+
// Track which client invoked this command
48+
const invokedBy = flags['invoked-by']
49+
if (invokedBy) {
50+
await addPublicMetadata(() => ({
51+
cmd_app_function_run_invoked_by: invokedBy,
52+
}))
53+
}
54+
4155
let functionExport = DEFAULT_FUNCTION_EXPORT
4256

4357
const app = await localAppContext({

packages/cli-kit/src/public/node/monorail.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ export interface Schemas {
8888
cmd_app_warning_api_key_deprecation_displayed?: Optional<boolean>
8989
cmd_app_deployment_mode?: Optional<string>
9090

91+
// Function related commands
92+
cmd_app_function_run_invoked_by?: Optional<string>
93+
9194
// Dev related commands
9295
cmd_dev_tunnel_type?: Optional<string>
9396
cmd_dev_tunnel_custom_hash?: Optional<string>

packages/cli/oclif.manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,15 @@
11311131
"name": "input",
11321132
"type": "option"
11331133
},
1134+
"invoked-by": {
1135+
"description": "Internal flag to track which client invoked this command.",
1136+
"env": "SHOPIFY_FLAG_INVOKED_BY",
1137+
"hasDynamicHelp": false,
1138+
"hidden": true,
1139+
"multiple": false,
1140+
"name": "invoked-by",
1141+
"type": "option"
1142+
},
11341143
"json": {
11351144
"allowNo": false,
11361145
"char": "j",

0 commit comments

Comments
 (0)