Skip to content

merge host metric tests into single infra test#662

Merged
movence merged 2 commits intomainfrom
movence/local-host-metrics
Mar 17, 2026
Merged

merge host metric tests into single infra test#662
movence merged 2 commits intomainfrom
movence/local-host-metrics

Conversation

@movence
Copy link
Contributor

@movence movence commented Mar 17, 2026

Description of changes

Refactor test/metric_value_benchmark/ to consolidate the 9 individual infra metric plugin configs (cpu, mem, disk, diskio, net, netstat, swap, processes, procstat) into one unified agent config and one runner that validates all infra metrics in a single agent start/stop cycle. Then run this same metric_value_benchmark test from the localtest Docker container.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

cd /local/home/amazon-cloudwatch-agent-test/localtest && docker compose exec cwagent-test bash -c "cd /workspace && mkdir -p .tmp && TMPDIR=/workspace/.tmp AWS_REGION=us-east-1 go test -v -timeout 10m -count=1 ./test/metric_value_benchmark/ -computeType EC2 -plugins AllInfra" 2>&1 | tail -120 (using tool: shell)

2026/03/17 19:00:34 instruction {process_name {0xc00041b9b0}} provider LocalImageIdDimensionProvider returned dimension {<nil> <nil> {}}
2026/03/17 19:00:34 instruction {process_name {0xc00041b9b0}} provider LocalInstanceTypeDimensionProvider returned dimension {<nil> <nil> {}}
2026/03/17 19:00:34 instruction {process_name {0xc00041b9b0}} provider VolumeIdDimensionProvider returned dimension {<nil> <nil> {}}
2026/03/17 19:00:34 instruction {process_name {0xc00041b9b0}} provider SerialIdDimensionProvider returned dimension {<nil> <nil> {}}
2026/03/17 19:00:34 instruction {process_name {0xc00041b9b0}} provider CustomDimensionProvider returned dimension {0xc00041bad0 0xc00041bae0 {}}
2026/03/17 19:00:34 Result dim is : process_name, amazon-cloudwatch-agent
2026/03/17 19:00:34 instruction {InstanceId {<nil>}} provider HostDimensionProvider returned dimension {<nil> <nil> {}}
2026/03/17 19:00:34 instruction {InstanceId {<nil>}} provider LocalInstanceIdDimensionProvider returned dimension {0xc00041bb30 0xc00041bb40 {}}
2026/03/17 19:00:34 Result dim is : InstanceId, i-1234567890abcdef0
2026/03/17 19:00:34 Metric query input dimensions
2026/03/17 19:00:34     Dimensions:
2026/03/17 19:00:34             Dim(name="exe", val="cloudwatch-agent")
2026/03/17 19:00:34             Dim(name="process_name", val="amazon-cloudwatch-agent")
2026/03/17 19:00:34             Dim(name="InstanceId", val="i-1234567890abcdef0")
2026/03/17 19:00:34 Metric data input: namespace MetricValueBenchmarkTest, name procstat_memory_vms, stat Average, period 10
2026/03/17 19:00:34 Query time window: startTime=2026-03-17T18:50:34Z, endTime=2026-03-17T19:00:34Z
2026/03/17 19:00:34 Metric values are : [1.439584256e+09 1.439584256e+09 1.439584256e+09 1.439584256e+09 1.439584256e+09 1.439584256e+09 1.439322112e+09 1.439322112e+09 1.439322112e+09 1.439322112e+09 1.439322112e+09 1.439322112e+09]
2026/03/17 19:00:34 The average value 1439453184.000000 for metric procstat_memory_vms are within bound [0.000000, 0.000000]
2026/03/17 19:00:34 >>>>>>>>>>>>>><<<<<<<<<<<<<<
2026/03/17 19:00:34 >>>>>>>>>>>>>>Successful<<<<<<<<<<<<<<
2026/03/17 19:00:34 ==============AllInfra==============
2026/03/17 19:00:34 ==============Successful==============
cpu_time_guest             Successful     
cpu_time_guest_nice        Successful     
cpu_time_idle              Successful     
cpu_time_iowait            Successful     
cpu_time_irq               Successful     
cpu_time_nice              Successful     
cpu_time_softirq           Successful     
cpu_time_steal             Successful     
cpu_time_system            Successful     
cpu_time_user              Successful     
cpu_usage_active           Successful     
cpu_usage_guest            Successful     
cpu_usage_guest_nice       Successful     
cpu_usage_idle             Successful     
cpu_usage_iowait           Successful     
cpu_usage_irq              Successful     
cpu_usage_nice             Successful     
cpu_usage_softirq          Successful     
cpu_usage_steal            Successful     
cpu_usage_system           Successful     
cpu_usage_user             Successful     
cpu_time_active_renamed    Successful     
mem_active                 Successful     
mem_available              Successful     
mem_available_percent      Successful     
mem_buffered               Successful     
mem_cached                 Successful     
mem_free                   Successful     
mem_inactive               Successful     
mem_shared                 Successful     
mem_total                  Successful     
mem_used                   Successful     
mem_used_percent           Successful     
disk_free                  Successful     
disk_inodes_free           Successful     
disk_inodes_total          Successful     
disk_inodes_used           Successful     
disk_total                 Successful     
disk_used                  Successful     
disk_used_percent          Successful     
diskio_iops_in_progress    Successful     
diskio_io_time             Successful     
diskio_reads               Successful     
diskio_read_bytes          Successful     
diskio_read_time           Successful     
diskio_writes              Successful     
diskio_write_bytes         Successful     
diskio_write_time          Successful     
net_bytes_sent             Successful     
net_bytes_recv             Successful     
net_drop_in                Successful     
net_drop_out               Successful     
net_err_in                 Successful     
net_err_out                Successful     
net_packets_sent           Successful     
net_packets_recv           Successful     
netstat_tcp_close          Successful     
netstat_tcp_close_wait     Successful     
netstat_tcp_closing        Successful     
netstat_tcp_established    Successful     
netstat_tcp_fin_wait1      Successful     
netstat_tcp_fin_wait2      Successful     
netstat_tcp_last_ack       Successful     
netstat_tcp_listen         Successful     
netstat_tcp_none           Successful     
netstat_tcp_syn_sent       Successful     
netstat_tcp_syn_recv       Successful     
netstat_tcp_time_wait      Successful     
netstat_udp_socket         Successful     
swap_free                  Successful     
swap_used                  Successful     
swap_used_percent          Successful     
processes_blocked          Successful     
processes_dead             Successful     
processes_idle             Successful     
processes_paging           Successful     
processes_running          Successful     
processes_sleeping         Successful     
processes_stopped          Successful     
processes_total            Successful     
processes_total_threads    Successful     
processes_zombies          Successful     
procstat_cpu_time_system   Successful     
procstat_cpu_time_user     Successful     
procstat_cpu_usage         Successful     
procstat_memory_data       Successful     
procstat_memory_locked     Successful     
procstat_memory_rss        Successful     
procstat_memory_stack      Successful     
procstat_memory_swap       Successful     
procstat_memory_vms        Successful     
2026/03/17 19:00:34 ==============================
2026/03/17 19:00:34 >>>>>>>>>>>>>>><<<<<<<<<<<<<<<
>>>> Finished MetricBenchmarkTestSuite
--- PASS: TestMetricValueBenchmarkSuite (83.03s)
    --- PASS: TestMetricValueBenchmarkSuite/TestAllInSuite (83.02s)
PASS
ok      github.com/aws/amazon-cloudwatch-agent-test/test/metric_value_benchmark 83.039s
 - Completed in 84.741s

> All 89 metrics pass. 

cd /local/amazon-cloudwatch-agent-test/localtest && docker compose down 2>&1 (using tool: shell)

 Container localtest-cwagent-test-1  Stopping
 Container localtest-cwagent-test-1  Stopped
 Container localtest-cwagent-test-1  Removing
 Container localtest-cwagent-test-1  Removed
 Container localtest-imds-mock-1  Stopping
 Container localtest-imds-mock-1  Stopped
 Container localtest-imds-mock-1  Removing
 Container localtest-imds-mock-1  Removed
 Network localtest_default  Removing
 Network localtest_default  Removed

@movence movence requested a review from a team as a code owner March 17, 2026 15:01
@movence movence force-pushed the movence/local-host-metrics branch from 3b9fd41 to 7b1638a Compare March 17, 2026 15:06
phugay
phugay previously approved these changes Mar 17, 2026
@movence movence changed the title add host metrics local test merge host metric tests into single infra test Mar 17, 2026
@movence movence merged commit 6584fe9 into main Mar 17, 2026
6 checks passed
@movence movence deleted the movence/local-host-metrics branch March 17, 2026 21:00
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

Successfully merging this pull request may close these issues.

3 participants