Skip to content

Commit 199d1c2

Browse files
author
Eugene Cheung
authored
fix(apigateway): use deployed stage's name when using MonitoringAspect (#409)
Fixes #381 --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent 661a018 commit 199d1c2

File tree

3 files changed

+127
-9
lines changed

3 files changed

+127
-9
lines changed

lib/facade/MonitoringAspect.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export class MonitoringAspect implements IAspect {
106106
if (isEnabled && node instanceof apigw.RestApi) {
107107
this.monitoringFacade.monitorApiGateway({
108108
api: node,
109+
apiStage: node.deploymentStage.stageName,
109110
...props,
110111
});
111112
}

test/facade/MonitoringAspect.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ describe("MonitoringAspect", () => {
8989
const api = new apigw.RestApi(stack, "DummyRestApi");
9090
api.root.addMethod("ANY");
9191

92+
const deployment = new apigw.Deployment(stack, "DummyRestApiDeployment", {
93+
api,
94+
});
95+
new apigw.Stage(stack, "DummyRestApiDevStage", {
96+
deployment,
97+
stageName: "DevStage",
98+
});
99+
api.deploymentStage = new apigw.Stage(stack, "DummyRestApiProdStage", {
100+
deployment,
101+
stageName: "ProdStage",
102+
});
103+
92104
// WHEN
93105
facade.monitorScope(stack, defaultAspectProps);
94106

test/facade/__snapshots__/MonitoringAspect.test.ts.snap

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

0 commit comments

Comments
 (0)