feat(MonitoringAspect): add Fargate service support#734
Open
costmatt-amzn wants to merge 1 commit intocdklabs:mainfrom
Open
feat(MonitoringAspect): add Fargate service support#734costmatt-amzn wants to merge 1 commit intocdklabs:mainfrom
costmatt-amzn wants to merge 1 commit intocdklabs:mainfrom
Conversation
auto-merge was automatically disabled
April 17, 2026 19:50
Head branch was pushed to by a user without write access
6c821f8 to
7748551
Compare
Wire Fargate services into the auto-applied MonitoringAspect so that teams relying on the aspect for fleet-wide auto-monitoring get Fargate coverage without manual opt-in. Covers three cases: - Bare ecs.FargateService → monitorSimpleFargateService (service-only metrics: CPU, memory, task counts) - ApplicationLoadBalancedFargateService / NetworkLoadBalancedFargateService → monitorFargateService (service + ALB/NLB + target group metrics) - QueueProcessingFargateService → monitorQueueProcessingFargateService (service + SQS queue + DLQ metrics) To prevent double-monitoring, the bare FargateService visitor skips services whose ancestor chain contains one of the L3 pattern constructs — those are already covered by the dedicated visitors. Changes: - IMonitoringAspect: add FargateServiceAspectType, LoadBalancedFargateServiceAspectType, QueueProcessingFargateServiceAspectType and the three corresponding props (fargateService, fargateLoadBalancedService, queueProcessingFargateService) on MonitoringAspectProps. - MonitoringAspect: add monitorFargateService, monitorFargateLoadBalancedService, monitorQueueProcessingFargateService visitors and an isInsideFargatePattern helper. - FargateServiceMonitoring: export BaseFargateServiceMonitoringProps and BaseLoadBalancedFargateServiceMonitoringProps so they can be referenced as aspect-option types (jsii requires named interfaces). - misc: add BaseQueueProcessingFargateServiceMonitoringOptions (thin alias over the package-private BaseQueueProcessingServiceMonitoringProps) for the same reason. - API.md: regenerated by projen.
7748551 to
024a810
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Wires Fargate services into the auto-applied
MonitoringAspectso that teams relying on the aspect for fleet-wide auto-monitoring get Fargate coverage without manual opt-in.Covers three cases:
ecs.FargateService(bare)monitorSimpleFargateServiceApplicationLoadBalancedFargateService/NetworkLoadBalancedFargateServicemonitorFargateServiceQueueProcessingFargateServicemonitorQueueProcessingFargateServiceTo prevent double-monitoring, the bare
FargateServicevisitor skips services whose ancestor chain contains one of the L3 pattern constructs — those are already covered by the dedicated visitors.Why
MonitoringFacadealready exposes all of the Fargate monitoring methods, but none of them were reachable throughMonitoringAspect. Teams that use the aspect for fleet-wide auto-monitoring had to opt Fargate services in manually. This change closes that gap and mirrors the wiring pattern already used for Lambda, API Gateway, DynamoDB, etc.Changes
lib/facade/IMonitoringAspect.tsFargateServiceAspectType,LoadBalancedFargateServiceAspectType,QueueProcessingFargateServiceAspectType.fargateService,fargateLoadBalancedService,queueProcessingFargateServicetoMonitoringAspectProps.lib/facade/MonitoringAspect.tsmonitorFargateService,monitorFargateLoadBalancedService,monitorQueueProcessingFargateServicevisitors.isInsideFargatePatternhelper to de-duplicate the bare-service match inside L3 patterns.lib/monitoring/aws-ecs-patterns/FargateServiceMonitoring.tsBaseFargateServiceMonitoringPropsandBaseLoadBalancedFargateServiceMonitoringPropsso they can be used as aspect-option types (jsii requires named interfaces;Omit<>transforms aren't accepted).lib/monitoring/aws-ecs-patterns/misc.tsBaseQueueProcessingFargateServiceMonitoringOptionsas a public alias over the package-privateBaseQueueProcessingServiceMonitoringProps, for the same reason.API.md— regenerated by projen.Usage
Testing
yarn buildpasses locally (compile + test + eslint + jsii assembly + pacmak for js/java/python/dotnet/go).Out of scope
Ec2Service+ L3 patterns with ancestor-skip logic).