Skip to content

Commit 810dfe5

Browse files
authored
fix(telemetry): lift local defs into aws-toolkit-common #2676
aws/aws-toolkit-common#324
1 parent 60089c2 commit 810dfe5

File tree

5 files changed

+14
-68
lines changed

5 files changed

+14
-68
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2938,7 +2938,7 @@
29382938
"report": "nyc report --reporter=html --reporter=json"
29392939
},
29402940
"devDependencies": {
2941-
"@aws-toolkits/telemetry": "1.0.49",
2941+
"@aws-toolkits/telemetry": "^1.0.54",
29422942
"@sinonjs/fake-timers": "^8.1.0",
29432943
"@types/adm-zip": "^0.4.34",
29442944
"@types/async-lock": "^1.1.3",

src/lambda/commands/createNewSamApp.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ export async function resumeCreateNewSamApp(
107107
getLogger().error('Error resuming new SAM Application: %O', err as Error)
108108
} finally {
109109
activationReloadState.clearSamInitState()
110+
const arch = samInitState?.architecture as telemetry.LambdaArchitecture
110111
telemetry.recordSamInit({
111112
lambdaPackageType: samInitState?.isImage ? 'Image' : 'Zip',
113+
lambdaArchitecture: arch,
112114
result: createResult,
113115
reason: reason,
114116
runtime: samInitState?.runtime as telemetry.Runtime,
115117
version: samVersion,
116-
architecture: samInitState?.architecture as telemetry.Architecture,
117118
})
118119
}
119120
}
@@ -340,11 +341,11 @@ export async function createNewSamApplication(
340341
} finally {
341342
telemetry.recordSamInit({
342343
lambdaPackageType: lambdaPackageType,
344+
lambdaArchitecture: initArguments?.architecture,
343345
result: createResult,
344346
reason: reason,
345347
runtime: createRuntime as telemetry.Runtime,
346348
version: samVersion,
347-
architecture: initArguments?.architecture,
348349
})
349350
}
350351
}

src/shared/sam/localLambdaRunner.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ async function invokeLambdaHandler(
218218
runtime: config.runtime as telemetry.Runtime,
219219
debug: !config.noDebug,
220220
httpMethod: config.api?.httpMethod,
221-
architecture: config.architecture,
221+
lambdaArchitecture: config.architecture,
222222
})
223223
}
224224

@@ -305,11 +305,11 @@ async function invokeLambdaHandler(
305305
}
306306
telemetry.recordLambdaInvokeLocal({
307307
lambdaPackageType: isImageLambdaConfig(config) ? 'Image' : 'Zip',
308+
lambdaArchitecture: config.architecture,
308309
result: invokeResult,
309310
runtime: config.runtime as telemetry.Runtime,
310311
debug: !config.noDebug,
311312
version: samVersion,
312-
architecture: config.architecture,
313313
})
314314
}
315315

@@ -402,11 +402,11 @@ export async function runLambdaFunction(
402402
onRecordAttachDebuggerMetric: (attachResult: boolean | undefined, attempts: number): void => {
403403
telemetry.recordSamAttachDebugger({
404404
lambdaPackageType: isImageLambdaConfig(config) ? 'Image' : 'Zip',
405+
lambdaArchitecture: config.architecture,
405406
runtime: config.runtime as telemetry.Runtime,
406407
result: attachResult ? 'Succeeded' : 'Failed',
407408
attempts: attempts,
408409
duration: timer.elapsedTime,
409-
architecture: config.architecture,
410410
})
411411
},
412412
})

src/shared/telemetry/vscodeTelemetry.json

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@
1616
"name": "starterTemplate",
1717
"type": "string",
1818
"description": "Starter template chosen during create document"
19-
},
20-
{
21-
"name": "architecture",
22-
"type": "string",
23-
"description": "SAM Application architecture",
24-
"allowedValues": ["x86_64", "arm64"]
2519
}
2620
],
2721
"metrics": [
@@ -145,55 +139,6 @@
145139
"type": "result"
146140
}
147141
]
148-
},
149-
{
150-
"name": "sam_init",
151-
"description": "Called when initing a sam application",
152-
"metadata": [
153-
{ "type": "result" },
154-
{ "type": "runtime", "required": false },
155-
{ "type": "templateName", "required": false },
156-
{ "type": "version", "required": false },
157-
{ "type": "lambdaPackageType", "required": false },
158-
{ "type": "reason", "required": false },
159-
{ "type": "eventBridgeSchema", "required": false },
160-
{ "type": "architecture", "required": false }
161-
]
162-
},
163-
{
164-
"name": "apigateway_invokeLocal",
165-
"description": "Invoking one simulated API Gateway call using the SAM cli",
166-
"metadata": [
167-
{ "type": "runtime", "required": false },
168-
{ "type": "httpMethod", "required": false },
169-
{ "type": "result" },
170-
{ "type": "debug" },
171-
{ "type": "architecture", "required": false }
172-
]
173-
},
174-
{
175-
"name": "lambda_invokeLocal",
176-
"description": "Called when invoking lambdas locally (with SAM in most toolkits)",
177-
"metadata": [
178-
{ "type": "runtime", "required": false },
179-
{ "type": "version", "required": false },
180-
{ "type": "lambdaPackageType" },
181-
{ "type": "result" },
182-
{ "type": "debug" },
183-
{ "type": "architecture", "required": false }
184-
]
185-
},
186-
{
187-
"name": "sam_attachDebugger",
188-
"description": "Called after trying to attach a debugger to a local sam invoke",
189-
"metadata": [
190-
{ "type": "result" },
191-
{ "type": "lambdaPackageType" },
192-
{ "type": "runtime" },
193-
{ "type": "attempts" },
194-
{ "type": "duration" },
195-
{ "type": "architecture", "required": false }
196-
]
197142
}
198143
]
199144
}

0 commit comments

Comments
 (0)