trallnag / prometheus-ecs-discoverer

Prometheus Service Discovery for ECS
MIT License
13 stars 5 forks source link

Problem with discovering PROVISIONING taks #12

Closed lejmr closed 3 years ago

lejmr commented 3 years ago

First of all, thank you for a great tool. I am right now facing to an issue when discovery is failing on jobs that don't have containerInstance atribut.

image

The cause, as I see it, is that the discovery tends to pick up all tasks, not the running ones only. An example of not running tasks is here

{
    "failures": [],
    "tasks": [
        {
            "launchType": "EC2",
            "group": "service:DEV__finriver",
            "attachments": [],
            "tags": [],
            "overrides": {
                "inferenceAcceleratorOverrides": [],
                "containerOverrides": []
            },
            "lastStatus": "PROVISIONING",
            "startedBy": "ecs-svc/9487742733633241351",
            "taskArn": "arn:aws:ecs:us-east-1:657399224926:task/engineering_cluster_dev/cc663905586946f0bfea150151475cd9",
            "healthStatus": "UNKNOWN",
            "containers": [],
            "version": 1,
            "memory": "6000",
            "desiredStatus": "RUNNING",
            "capacityProviderName": "engineering-compute-medium",
            "taskDefinitionArn": "arn:aws:ecs:us-east-1:657399224926:task-definition/api_DEV:34",
            "cpu": "0",
            "createdAt": 1628065687.452,
            "clusterArn": "arn:aws:ecs:us-east-1:657399224926:cluster/engineering_cluster_dev"
        }
    ]
}

I don't know which way you want to go, as there is a number of paths. Do you think is it ok to simple filter for lastStatus=RUNNING ? That would work for my case though.

trallnag commented 3 years ago

resolved, thanks for the pr. Also notice the following paragraph I just added to the main README regarding project status

https://github.com/trallnag/prometheus-ecs-discoverer#project-status