Skip to content

Commit

Permalink
Merge branch 'main' into node18
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Aug 10, 2023
2 parents ca0a2e9 + ab22198 commit 3835ba1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
HorizontalAnnotation,
IWidget,
} from "aws-cdk-lib/aws-cloudwatch";
import { IFunction, CfnFunction } from "aws-cdk-lib/aws-lambda";

import {
StepFunctionLambdaIntegrationMetricFactory,
Expand Down Expand Up @@ -71,10 +72,10 @@ export class StepFunctionLambdaIntegrationMonitoring extends Monitoring {
) {
super(scope, props);

const fallbackConstructName = props.lambdaFunction.functionName;
const namingStrategy = new MonitoringNamingStrategy({
...props,
fallbackConstructName,
namedConstruct: props.lambdaFunction,
fallbackConstructName: this.resolveFunctionName(props.lambdaFunction),
});
this.title = namingStrategy.resolveHumanReadableName();
this.functionUrl = scope
Expand Down Expand Up @@ -260,4 +261,9 @@ export class StepFunctionLambdaIntegrationMonitoring extends Monitoring {
}),
];
}

private resolveFunctionName(lambdaFunction: IFunction): string | undefined {
// try to take the name (if specified) instead of token
return (lambdaFunction.node.defaultChild as CfnFunction)?.functionName;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3835ba1

Please sign in to comment.