question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws-ecs-patterns): X-Ray support

See original GitHub issue

Please 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:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
AndrewGuenthercommented, Jan 5, 2022

@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.

5reactions
ahammondcommented, Apr 26, 2021

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found