Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/healthcheck doesn't work in ECS #2655

Open
louislatreille-cb opened this issue Feb 21, 2024 · 2 comments
Open

/healthcheck doesn't work in ECS #2655

louislatreille-cb opened this issue Feb 21, 2024 · 2 comments

Comments

@louislatreille-cb
Copy link

Describe the bug
As per the documentation and the examples in this repository, we can set the ECS healthCheck to the "/healthcheck" command.

After deploying the ADOT collector with this, the container remains unhealthy in ECS

Steps to reproduce
Deploy the ADOT collector with a healthcheck command as described in the documentation

What did you expect to see?
The container is becomes healthy after a few seconds

What did you see instead?
The container stays unhealthy forever

Environment
I'm using AWS CDK. Here's my container definition:

const adotContainer = taskDefinition.addContainer(`${id}-adot-container`, {
    image: ContainerImage.fromRegistry("amazon/aws-otel-collector:v0.37.0"),
    command: ["--config=/etc/ecs/ecs-cloudwatch-xray.yaml"],
    logging: LogDriver.awsLogs({
      logGroup: new LogGroup(scope, `${id}-adot-logs`, {
        logGroupName: `${id}-adot-logs`,
      }),
      streamPrefix: `${id}-adot-container`,
    }),
    healthCheck: {
      command: ["/healthcheck"],
    },
  });

Additional context
Add any other context about the problem here.

@zehsor
Copy link

zehsor commented Feb 29, 2024

you have to set the healthcheck the following way @louislatreille-cb:

healthCheck: {
             command: ["CMD", "/healthcheck"],
             timeout: Duration.seconds(5),
             interval: Duration.seconds(10),
             retries: 3,
             startPeriod: Duration.seconds(5),
       },

If you only set it to be "/healthcheck" the underlying cloudformation script will set it to use CMD-Shell. The ADOT collector does not come with a default shell.

Hope this was useful!

@louislatreille
Copy link

Thanks for the hint @zehsor, it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants