Move v4 TMDS container and task stats endpoint handlers to ecs-agent module #3791
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
Moving v4 TMDS container and task stats endpoint handlers to ecs-agent module.
The only difference between old handlers and the new handlers is that the latter support publishing metrics. The new handlers are coded to publish an Internal Server Error metric if a 5XX error occurs during the handling of a request. When consuming the new handlers, Agent is set up to inject a no-op metrics publisher, so there is no actual change in functionality introduced in this PR.
Implementation details
ecs-agent module -
GetContainerStats
andGetTaskStats
- toAgentState
interface for getting container and task stats, respectively, from Agent.ContainerStatsHandler
andTaskStatsHandler
- for container stats and task stats endpoints, respectively. The handlers depend on the new methods added toAgentState
interface.AgentState
method, andstatsHandler
function. Depending on the parameters provided it can work for both endpoints.agent module -
AgentState
interface methods forTMDSAgentState
type. The implementation is based on the existing implementation for stats endpoint handlers.Testing
Test-driven development was followed. Test coverage for container and task stats endpoints was improved in #3758 and #3761 before these changes to capture the current customer facing behavior of the endpoints. The same tests are passing for this PR, so there is no regression.
Manual regression, stress, and performance tests were also performed. For manual testing, agent was build from source of this PR and deployed to an EC2 instance. Another EC2 instance was provisioned with released Agent version v1.72.0.
For manual regression testing, container and task stats endpoints were called on both the instances and the results were compared using
diff
. No regression was detected.For manual stress testing, the endpoints were called at a rate of 3000 rps for 60 seconds. 100% of requests were successful. Note that the default TMDS rate limits are 40 steady and 60 burst, and so 3000 rps is considerably higher than the default.
For manual performance testing, agent was profiled for heap and CPU usage while stress tests were being performed as explained above. Similar heap and CPU usage was seen for both the Agents.
New tests cover the changes: yes
Description for the changelog
Move v4 TMDS container and task stats endpoint handlers to ecs-agent module
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.