Skip to content

Commit 69adaa9

Browse files
Fix getEnhancedMetricTags on local env (#87)
* Fix getEnhancedMetricTags on local env * Update enhanced-metrics.spec.ts Co-authored-by: Harvinder Ghotra <[email protected]>
1 parent 317796f commit 69adaa9

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/metrics/enhanced-metrics.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const mockContext = ({
1414
} as any) as Context;
1515
const mockContextLocal = ({
1616
functionName: "my-test-lambda",
17+
functionVersion: "1.0.0",
1718
memoryLimitInMB: "128",
1819
} as any) as Context;
1920

src/metrics/enhanced-metrics.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ export function getRuntimeTag(): string | null {
4545

4646
export function getEnhancedMetricTags(context: Context): string[] {
4747
let arnTags = [`functionname:${context.functionName}`];
48-
if (context.functionVersion) {
48+
if (context.invokedFunctionArn) {
4949
arnTags = parseTagsFromARN(context.invokedFunctionArn, context.functionVersion);
50-
} else if (context.invokedFunctionArn) {
51-
arnTags = parseTagsFromARN(context.invokedFunctionArn);
5250
}
5351
const tags = [...arnTags, getColdStartTag(), `memorysize:${context.memoryLimitInMB}`];
5452

0 commit comments

Comments
 (0)