aws-ecs: Metrics in imported FargateService
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Currently there are 3 ways to import Fargate Service:
```
// from FargateService
fromFargateServiceArn(scope: Construct, id: string, fargateServiceArn: string): IFargateService;
fromFargateServiceAttributes(scope: Construct, id: string, attrs: FargateServiceAttributes): IBaseService;
// from BaseService
fromServiceArnWithCluster(scope: Construct, id: string, serviceArn: string): IBaseService;
```
You can see that output it is either `IBaseService` or `IFargateService`
To get metrics as they currently defined i need to get `BaseService`:
```
metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
metricMemoryUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
metricCpuUtilization(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
```
For example `INetworkLoadBalancer` contains separate `metrics` property and i can easily use imported instance.
### Expected Behavior
Access to metrics provided via IBaseService or IFargateService
### Current Behavior
No access and no clear workaround.
### Reproduction Steps
See description please
### Possible Solution
Similar to `INetworkLoadBalancer` we can expose metrics property with defined metrics
### Additional Information/Context
_No response_
### CDK CLI Version
2.115.0 (build 58027ee)
### Framework Version
_No response_
### Node.js Version
18.x
### OS
AL2
### Language
TypeScript
### Language Version
~5.3
### Other information
_No response_
Contributor guide
Research direction
Start with the FargateService import methods and the IBaseService and IFargateService interfaces described in the issue. Compare their API with INetworkLoadBalancer's metrics property, then verify that imported Fargate services expose the listed metrics through their returned interfaces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100