Skip to content

Commit

Permalink
Fix getEnhancedMetricTags on local env (#87)
Browse files Browse the repository at this point in the history
* Fix getEnhancedMetricTags on local env
* Update enhanced-metrics.spec.ts

Co-authored-by: Harvinder Ghotra <[email protected]>
  • Loading branch information
jeromemacias and hghotra authored Aug 19, 2020
1 parent 317796f commit 69adaa9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/metrics/enhanced-metrics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const mockContext = ({
} as any) as Context;
const mockContextLocal = ({
functionName: "my-test-lambda",
functionVersion: "1.0.0",
memoryLimitInMB: "128",
} as any) as Context;

Expand Down
4 changes: 1 addition & 3 deletions src/metrics/enhanced-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ export function getRuntimeTag(): string | null {

export function getEnhancedMetricTags(context: Context): string[] {
let arnTags = [`functionname:${context.functionName}`];
if (context.functionVersion) {
if (context.invokedFunctionArn) {
arnTags = parseTagsFromARN(context.invokedFunctionArn, context.functionVersion);
} else if (context.invokedFunctionArn) {
arnTags = parseTagsFromARN(context.invokedFunctionArn);
}
const tags = [...arnTags, getColdStartTag(), `memorysize:${context.memoryLimitInMB}`];

Expand Down

0 comments on commit 69adaa9

Please sign in to comment.