Always report service connect metrics when both health and task metrics are disabled #3786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Currently, when both
ECS_DISABLE_METRICS
andECS_DISABLE_DOCKER_HEALTH_CHECK
are set to true on an EC2 instance, we skip creating the metrics session to connect with TACS, and thus no service connect metrics will be published.As agent does not know if there will be a SC task will be placed on this instance (besides instance capability; however, it is not useful in this case), and TACS session is created (or not created) at agent start, we have no way to only create connection as needed. Therefore, this PR removes the logic of skipping TACS session creation when both metrics and health check are disabled, i.e. will always create an connection even if there is no metrics reported.
Implementation details
This should be reviewed after #3743 is merged and rebased.
ECS_DISABLE_METRICS
andECS_DISABLE_DOCKER_HEALTH_CHECK
are enabledGetInstanceMetrics
to assure no empty metrics message will reach the channel of TCSClientTesting
New tests cover the changes: no.
Existing github testing workflow passed.
Manual testings:
ECS_DISABLE_METRICS
andECS_DISABLE_DOCKER_HEALTH_CHECK
to true on an EC2 instance, and enable debug logSC metrics are published every 3 metrics publish interval (metrics publish interval 20s). We can see empty task metrics in first 2 publish metrics process, publishMetrics is skipped; and in 3rd one we see publish metrics request with only SC metrics.
Health metrics are always sent, and that is for container
ecs-service-connect-HGeyfR
, which is also expected even when we disabled the health checks.Description for the changelog
Always report service connect metrics when both health and task metrics are disabled.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.