(aws-ecs-patterns): X-Ray support
See original GitHub issuePlease make it trivial to add the xray side-car for aws-ecs-patterns/ApplicationLoadBalancedFargateService etc.
Use Case
I want to encourage my developers to use X-Ray, to do this, I want to make it stupid easy to deploy X-Ray enables services.
Proposed Solution
const service = new ecsp.ApplicationLoadBalancedFargateService(this, 'service', {
...
xraySidecar: true
};
Where that runs something like https://github.com/aws-samples/one-observability-demo/blob/d11387bba7640f97dc42b01bb07f0d53cd98c8d7/PetAdoptions/cdk/pet_stack/lib/services/ecs-service.ts#L157
// Enable xray side-car
service.taskDefinition
.addContainer('xraydemon', {
image: ecs.ContainerImage.fromRegistry('public.ecr.aws/xray/aws-xray-daemon:latest'),
memoryLimitMiB: 256,
cpu: 256,
})
.addPortMappings({
containerPort: 2000,
protocol: ecs.Protocol.UDP,
});
Other
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Running the X-Ray daemon on Amazon ECS
In Amazon ECS, create a Docker image that runs the X-Ray daemon, upload it to a Docker image repository, and then deploy it...
Read more >aws-cdk/aws-ecs-patterns module - AWS Documentation
To define an Amazon ECS service that is behind a network load balancer, instantiate one of the following: NetworkLoadBalancedEc2Service. declare const cluster: ...
Read more >Deploying the CloudWatch agent and the X-Ray daemon on ...
On Amazon ECS, you deploy the CloudWatch agent as a sidecar to your application container to collect metrics. You can configure the CloudWatch...
Read more >AWS X-Ray Features
AWS X -Ray supports applications running on Amazon Elastic Compute Cloud (Amazon EC2), Amazon EC2 Container Service (Amazon ECS), AWS Lambda, and AWS...
Read more >AWS X-Ray - AWS Documentation
Use AWS X-Ray to monitor the components and services that make up your cloud applications. X-Ray provides a detailed service map and latency...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@SoManyHs I would push back on X-ray being considered advanced usage. It is a very common pattern across CDK constructs to have a boolean “Tracing enabled” option. Yes, I know that this isn’t a checkbox option with ECS, but I think it is still a fair consideration. Tracing is considered a well-architected best practice and should be made as easy as possible. I really think including it in ecs-patterns should be reconsidered. If ecs-patterns won’t follow well-architected practices out of the box, then I’d strongly encourage the entire module be deprecated in favor of Service Extensions.
@SoManyHs I see your point. From my perspective x-ray support is an implementation detail and what I’m trying to do is run a container in fargate. The same way that adding x-ray support to a lambda is a one-liner, https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-readme.html#lambda-with-x-ray-tracing it seems to me that adding x-ray support to an ECS Service ought to be a one-liner.