aws-observability / aws-otel-collector

AWS Distro for OpenTelemetry Collector (see ADOT Roadmap at https://github.com/orgs/aws-observability/projects/4)

Home Page:https://aws-otel.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

/healthcheck doesn't work in ECS

louislatreille-cb opened this issue · comments

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.

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!

Thanks for the hint @zehsor, it worked!

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

This issue was closed because it has been marked as stale for 30 days with no activity.