diff --git a/.golangci.yml b/.golangci.yml index 88f10bb240..33fff94918 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -51,7 +51,6 @@ linters: - goimports - gosec - gosimple - - govet - ineffassign - misspell - revive diff --git a/Makefile b/Makefile index 03e22d2f20..da9c8294a0 100644 --- a/Makefile +++ b/Makefile @@ -25,9 +25,9 @@ WIN_BUILD = GOOS=windows GOARCH=amd64 go build -trimpath -buildmode=${CWAGENT_BU DARWIN_BUILD_AMD64 = CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -trimpath -ldflags="${LDFLAGS}" -o $(BUILD_SPACE)/bin/darwin_amd64 DARWIN_BUILD_ARM64 = CGO_ENABLED=1 GO111MODULE=on GOOS=darwin GOARCH=arm64 go build -trimpath -ldflags="${LDFLAGS}" -o $(BUILD_SPACE)/bin/darwin_arm64 -IMAGE_REGISTRY = amazon -IMAGE_REPO = cloudwatch-agent -IMAGE_TAG = $(VERSION) +IMAGE_REGISTRY = 730335384949.dkr.ecr.us-west-2.amazonaws.com +IMAGE_REPO = cwagent +IMAGE_TAG = latest IMAGE = $(IMAGE_REGISTRY)/$(IMAGE_REPO):$(IMAGE_TAG) DOCKER_BUILD_FROM_SOURCE = docker build -t $(IMAGE) -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile DOCKER_WINDOWS_BUILD_FROM_SOURCE = docker build -t $(IMAGE) -f ./amazon-cloudwatch-container-insights/cloudwatch-agent-dockerfile/source/Dockerfile.Windows diff --git a/plugins/processors/awsentity/processor_test.go b/plugins/processors/awsentity/processor_test.go index bd263e0a4f..f865bf4fec 100644 --- a/plugins/processors/awsentity/processor_test.go +++ b/plugins/processors/awsentity/processor_test.go @@ -54,19 +54,6 @@ func newAddToMockEntityStore(rs *mockEntityStore) func(entitystore.LogGroupName, } } -func newMockGetMetricAttributesFromEntityStore() func() map[string]*string { - mockPlatform := "AWS::EC2" - mockInstanceID := "i-123456789" - mockAutoScalingGroup := "auto-scaling" - return func() map[string]*string { - return map[string]*string{ - entitystore.PlatformType: &mockPlatform, - entitystore.InstanceIDKey: &mockInstanceID, - entitystore.ASGKey: &mockAutoScalingGroup, - } - } -} - func newMockGetServiceNameAndSource(service, source string) func() (string, string) { return func() (string, string) { return service, source diff --git a/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml b/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml index 29a6edb0ef..6c425849d1 100644 --- a/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml +++ b/translator/tocwconfig/sampleConfig/advanced_config_darwin.yaml @@ -45,10 +45,11 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - InstanceId - InstanceType - ImageId - - InstanceId imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_cpu: @@ -88,11 +89,11 @@ service: - awsentity/resource - ec2tagger receivers: + - telegraf_swap + - telegraf_cpu - telegraf_disk - telegraf_mem - telegraf_netstat - - telegraf_swap - - telegraf_cpu metrics/hostDeltaMetrics: exporters: - awscloudwatch diff --git a/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml b/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml index 14da19542a..5dddb3f844 100644 --- a/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/advanced_config_linux.yaml @@ -49,6 +49,7 @@ processors: - InstanceId - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_cpu: @@ -96,13 +97,13 @@ service: - awsentity/resource - ec2tagger receivers: - - telegraf_swap - - telegraf_ethtool - telegraf_nvidia_smi - telegraf_cpu - telegraf_disk - telegraf_mem - telegraf_netstat + - telegraf_swap + - telegraf_ethtool metrics/hostDeltaMetrics: exporters: - awscloudwatch diff --git a/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml b/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml index c74cfc6b2f..bd3e45ed9e 100644 --- a/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/advanced_config_windows.yaml @@ -39,6 +39,7 @@ processors: - InstanceId - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_win_perf_counters/1492679118: @@ -89,13 +90,13 @@ service: - awsentity/resource - ec2tagger receivers: - - telegraf_win_perf_counters/3446270237 - - telegraf_win_perf_counters/3762679655 - telegraf_win_perf_counters/2073218482 - telegraf_win_perf_counters/2039663244 - telegraf_win_perf_counters/4283769065 - telegraf_win_perf_counters/1492679118 - telegraf_win_perf_counters/3610923661 + - telegraf_win_perf_counters/3446270237 + - telegraf_win_perf_counters/3762679655 telemetry: logs: development: false diff --git a/translator/tocwconfig/sampleConfig/amp_config_linux.yaml b/translator/tocwconfig/sampleConfig/amp_config_linux.yaml index b2bc150898..db8306774d 100644 --- a/translator/tocwconfig/sampleConfig/amp_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/amp_config_linux.yaml @@ -98,10 +98,11 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - ImageId - InstanceId - InstanceType - - ImageId imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s rollup: attribute_groups: diff --git a/translator/tocwconfig/sampleConfig/basic_config_linux.yaml b/translator/tocwconfig/sampleConfig/basic_config_linux.yaml index c6aeb04fee..caa5cfc15b 100644 --- a/translator/tocwconfig/sampleConfig/basic_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/basic_config_linux.yaml @@ -39,6 +39,7 @@ processors: - InstanceId - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_disk: diff --git a/translator/tocwconfig/sampleConfig/basic_config_windows.yaml b/translator/tocwconfig/sampleConfig/basic_config_windows.yaml index 6b4882b964..8f5d51fc73 100644 --- a/translator/tocwconfig/sampleConfig/basic_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/basic_config_windows.yaml @@ -35,10 +35,11 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - InstanceType - ImageId - InstanceId - - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_win_perf_counters/1492679118: diff --git a/translator/tocwconfig/sampleConfig/compass_linux_config.yaml b/translator/tocwconfig/sampleConfig/compass_linux_config.yaml index 6552403fe1..cdc02e2d2f 100644 --- a/translator/tocwconfig/sampleConfig/compass_linux_config.yaml +++ b/translator/tocwconfig/sampleConfig/compass_linux_config.yaml @@ -47,10 +47,11 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: - - ImageId - InstanceId - InstanceType + - ImageId imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_socket_listener: diff --git a/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml b/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml index f809fc2ef0..4ad0290915 100644 --- a/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_darwin_config.yaml @@ -137,6 +137,7 @@ processors: - InstanceId - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s transform: error_mode: propagate @@ -145,11 +146,11 @@ processors: metric_statements: - context: metric statements: + - set(unit, "unit") where name == "disk_free" + - set(name, "DISK_FREE") where name == "disk_free" - set(unit, "unit") where name == "cpu_usage_idle" - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" - set(unit, "unit") where name == "cpu_usage_nice" - - set(unit, "unit") where name == "disk_free" - - set(name, "DISK_FREE") where name == "disk_free" trace_statements: [] receivers: awsxray: @@ -283,12 +284,12 @@ service: - ec2tagger - transform receivers: + - telegraf_swap - telegraf_netstat - telegraf_disk + - telegraf_mem - telegraf_processes - telegraf_procstat/1917393364 - - telegraf_mem - - telegraf_swap - telegraf_cpu metrics/hostCustomMetrics: exporters: @@ -298,8 +299,8 @@ service: - ec2tagger - transform receivers: - - telegraf_socket_listener - telegraf_statsd + - telegraf_socket_listener metrics/hostDeltaMetrics: exporters: - awscloudwatch @@ -309,8 +310,8 @@ service: - ec2tagger - transform receivers: - - telegraf_diskio - telegraf_net + - telegraf_diskio traces/xray: exporters: - awsxray diff --git a/translator/tocwconfig/sampleConfig/complete_linux_config.yaml b/translator/tocwconfig/sampleConfig/complete_linux_config.yaml index 192a2475ee..b9decbb138 100644 --- a/translator/tocwconfig/sampleConfig/complete_linux_config.yaml +++ b/translator/tocwconfig/sampleConfig/complete_linux_config.yaml @@ -150,6 +150,7 @@ processors: - InstanceId - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s filter/jmx/0: error_mode: propagate @@ -197,11 +198,11 @@ processors: metric_statements: - context: metric statements: - - set(unit, "unit") where name == "disk_free" - - set(name, "DISK_FREE") where name == "disk_free" - set(unit, "unit") where name == "cpu_usage_idle" - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" - set(unit, "unit") where name == "cpu_usage_nice" + - set(unit, "unit") where name == "disk_free" + - set(name, "DISK_FREE") where name == "disk_free" trace_statements: [] transform/jmx/0: error_mode: propagate @@ -390,13 +391,13 @@ service: - ec2tagger - transform receivers: - - telegraf_netstat - - telegraf_disk - telegraf_processes - telegraf_cpu - - telegraf_mem - - telegraf_procstat/1917393364 - telegraf_swap + - telegraf_procstat/1917393364 + - telegraf_disk + - telegraf_netstat + - telegraf_mem metrics/hostCustomMetrics/cloudwatch: exporters: - awscloudwatch @@ -416,8 +417,8 @@ service: - ec2tagger - transform receivers: - - telegraf_diskio - telegraf_net + - telegraf_diskio metrics/jmx/cloudwatch/0: exporters: - awscloudwatch diff --git a/translator/tocwconfig/sampleConfig/delta_config_linux.yaml b/translator/tocwconfig/sampleConfig/delta_config_linux.yaml index ce2a63c26f..0abb2d4c66 100644 --- a/translator/tocwconfig/sampleConfig/delta_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/delta_config_linux.yaml @@ -45,10 +45,11 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - ImageId - InstanceId - InstanceType - - ImageId imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s transform: error_mode: propagate diff --git a/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml b/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml index 7787666540..e9ed041ca5 100644 --- a/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/delta_net_config_linux.yaml @@ -42,10 +42,11 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: - - ImageId - InstanceId - InstanceType + - ImageId imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_net: diff --git a/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml b/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml index baad241f77..65c7eff23e 100644 --- a/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml +++ b/translator/tocwconfig/sampleConfig/drop_origin_linux.yaml @@ -40,10 +40,11 @@ processors: ec2_instance_tag_keys: - AutoScalingGroupName ec2_metadata_tags: + - ImageId - InstanceId - InstanceType - - ImageId imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s transform: error_mode: propagate diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml index eb4f404843..44fccdb2b6 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_with_gpu_config.yaml @@ -692,9 +692,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_USED + include: DCGM_FI_DEV_FB_USED_PERCENT match_type: "" - new_name: container_gpu_memory_used + new_name: container_gpu_memory_utilization operations: - action: add_label aggregation_type: "" @@ -705,7 +705,7 @@ processors: new_value: ContainerGPU - action: experimental_scale_value aggregation_type: "" - experimental_scale: 1.048576e+06 + experimental_scale: 100 label: "" label_value: "" new_label: "" @@ -713,9 +713,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_USED + include: DCGM_FI_DEV_FB_USED_PERCENT match_type: "" - new_name: pod_gpu_memory_used + new_name: pod_gpu_memory_utilization operations: - action: add_label aggregation_type: "" @@ -726,7 +726,7 @@ processors: new_value: PodGPU - action: experimental_scale_value aggregation_type: "" - experimental_scale: 1.048576e+06 + experimental_scale: 100 label: "" label_value: "" new_label: "" @@ -734,9 +734,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_USED + include: DCGM_FI_DEV_FB_USED_PERCENT match_type: "" - new_name: node_gpu_memory_used + new_name: node_gpu_memory_utilization operations: - action: add_label aggregation_type: "" @@ -747,7 +747,7 @@ processors: new_value: NodeGPU - action: experimental_scale_value aggregation_type: "" - experimental_scale: 1.048576e+06 + experimental_scale: 100 label: "" label_value: "" new_label: "" @@ -755,9 +755,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_TOTAL + include: DCGM_FI_DEV_FB_USED match_type: "" - new_name: container_gpu_memory_total + new_name: container_gpu_memory_used operations: - action: add_label aggregation_type: "" @@ -776,9 +776,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_TOTAL + include: DCGM_FI_DEV_FB_USED match_type: "" - new_name: pod_gpu_memory_total + new_name: pod_gpu_memory_used operations: - action: add_label aggregation_type: "" @@ -797,9 +797,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_TOTAL + include: DCGM_FI_DEV_FB_USED match_type: "" - new_name: node_gpu_memory_total + new_name: node_gpu_memory_used operations: - action: add_label aggregation_type: "" @@ -818,9 +818,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_GPU_TEMP + include: DCGM_FI_DEV_FB_TOTAL match_type: "" - new_name: container_gpu_temperature + new_name: container_gpu_memory_total operations: - action: add_label aggregation_type: "" @@ -829,12 +829,19 @@ processors: label_value: "" new_label: Type new_value: ContainerGPU + - action: experimental_scale_value + aggregation_type: "" + experimental_scale: 1.048576e+06 + label: "" + label_value: "" + new_label: "" + new_value: "" submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_GPU_TEMP + include: DCGM_FI_DEV_FB_TOTAL match_type: "" - new_name: pod_gpu_temperature + new_name: pod_gpu_memory_total operations: - action: add_label aggregation_type: "" @@ -843,12 +850,19 @@ processors: label_value: "" new_label: Type new_value: PodGPU + - action: experimental_scale_value + aggregation_type: "" + experimental_scale: 1.048576e+06 + label: "" + label_value: "" + new_label: "" + new_value: "" submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_GPU_TEMP + include: DCGM_FI_DEV_FB_TOTAL match_type: "" - new_name: node_gpu_temperature + new_name: node_gpu_memory_total operations: - action: add_label aggregation_type: "" @@ -857,12 +871,19 @@ processors: label_value: "" new_label: Type new_value: NodeGPU + - action: experimental_scale_value + aggregation_type: "" + experimental_scale: 1.048576e+06 + label: "" + label_value: "" + new_label: "" + new_value: "" submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_POWER_USAGE + include: DCGM_FI_DEV_GPU_TEMP match_type: "" - new_name: container_gpu_power_draw + new_name: container_gpu_temperature operations: - action: add_label aggregation_type: "" @@ -874,9 +895,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_POWER_USAGE + include: DCGM_FI_DEV_GPU_TEMP match_type: "" - new_name: pod_gpu_power_draw + new_name: pod_gpu_temperature operations: - action: add_label aggregation_type: "" @@ -888,9 +909,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_POWER_USAGE + include: DCGM_FI_DEV_GPU_TEMP match_type: "" - new_name: node_gpu_power_draw + new_name: node_gpu_temperature operations: - action: add_label aggregation_type: "" @@ -902,9 +923,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_GPU_UTIL + include: DCGM_FI_DEV_POWER_USAGE match_type: "" - new_name: container_gpu_utilization + new_name: container_gpu_power_draw operations: - action: add_label aggregation_type: "" @@ -916,9 +937,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_GPU_UTIL + include: DCGM_FI_DEV_POWER_USAGE match_type: "" - new_name: pod_gpu_utilization + new_name: pod_gpu_power_draw operations: - action: add_label aggregation_type: "" @@ -930,9 +951,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_GPU_UTIL + include: DCGM_FI_DEV_POWER_USAGE match_type: "" - new_name: node_gpu_utilization + new_name: node_gpu_power_draw operations: - action: add_label aggregation_type: "" @@ -944,9 +965,9 @@ processors: submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_USED_PERCENT + include: DCGM_FI_DEV_GPU_UTIL match_type: "" - new_name: container_gpu_memory_utilization + new_name: container_gpu_utilization operations: - action: add_label aggregation_type: "" @@ -955,19 +976,12 @@ processors: label_value: "" new_label: Type new_value: ContainerGPU - - action: experimental_scale_value - aggregation_type: "" - experimental_scale: 100 - label: "" - label_value: "" - new_label: "" - new_value: "" submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_USED_PERCENT + include: DCGM_FI_DEV_GPU_UTIL match_type: "" - new_name: pod_gpu_memory_utilization + new_name: pod_gpu_utilization operations: - action: add_label aggregation_type: "" @@ -976,19 +990,12 @@ processors: label_value: "" new_label: Type new_value: PodGPU - - action: experimental_scale_value - aggregation_type: "" - experimental_scale: 100 - label: "" - label_value: "" - new_label: "" - new_value: "" submatch_case: "" - action: insert aggregation_type: "" - include: DCGM_FI_DEV_FB_USED_PERCENT + include: DCGM_FI_DEV_GPU_UTIL match_type: "" - new_name: node_gpu_memory_utilization + new_name: node_gpu_utilization operations: - action: add_label aggregation_type: "" @@ -997,40 +1004,19 @@ processors: label_value: "" new_label: Type new_value: NodeGPU - - action: experimental_scale_value - aggregation_type: "" - experimental_scale: 100 - label: "" - label_value: "" - new_label: "" - new_value: "" submatch_case: "" - action: update aggregation_type: "" - include: neuroncore_utilization_ratio - match_type: "" - new_name: neuroncore_utilization - operations: - - action: experimental_scale_value - aggregation_type: "" - experimental_scale: 100 - label: "" - label_value: "" - new_label: "" - new_value: "" - submatch_case: "" - - action: update - aggregation_type: "" - include: neuron_hardware + include: execution_latency_seconds match_type: "" - new_name: neuron_hardware + new_name: neuron_execution_latency operations: [] submatch_case: "" - action: update aggregation_type: "" - include: hardware_ecc_events_total + include: execution_errors_total match_type: "" - new_name: neurondevice_hw_ecc_events + new_name: neuron_execution_errors operations: [] submatch_case: "" - action: update @@ -1049,16 +1035,9 @@ processors: submatch_case: "" - action: update aggregation_type: "" - include: neuroncore_memory_usage_runtime_memory - match_type: "" - new_name: neuroncore_memory_usage_runtime_memory - operations: [] - submatch_case: "" - - action: update - aggregation_type: "" - include: neuroncore_memory_usage_tensors + include: neuroncore_memory_usage_model_shared_scratchpad match_type: "" - new_name: neuroncore_memory_usage_tensors + new_name: neuroncore_memory_usage_model_shared_scratchpad operations: [] submatch_case: "" - action: update @@ -1070,16 +1049,16 @@ processors: submatch_case: "" - action: update aggregation_type: "" - include: execution_latency_seconds + include: neuron_hardware match_type: "" - new_name: neuron_execution_latency + new_name: neuron_hardware operations: [] submatch_case: "" - action: update aggregation_type: "" - include: execution_errors_total + include: hardware_ecc_events_total match_type: "" - new_name: neuron_execution_errors + new_name: neurondevice_hw_ecc_events operations: [] submatch_case: "" - action: update @@ -1098,11 +1077,32 @@ processors: submatch_case: "" - action: update aggregation_type: "" - include: neuroncore_memory_usage_model_shared_scratchpad + include: neuroncore_memory_usage_runtime_memory match_type: "" - new_name: neuroncore_memory_usage_model_shared_scratchpad + new_name: neuroncore_memory_usage_runtime_memory + operations: [] + submatch_case: "" + - action: update + aggregation_type: "" + include: neuroncore_memory_usage_tensors + match_type: "" + new_name: neuroncore_memory_usage_tensors operations: [] submatch_case: "" + - action: update + aggregation_type: "" + include: neuroncore_utilization_ratio + match_type: "" + new_name: neuroncore_utilization + operations: + - action: experimental_scale_value + aggregation_type: "" + experimental_scale: 100 + label: "" + label_value: "" + new_label: "" + new_value: "" + submatch_case: "" receivers: awscontainerinsightreceiver: accelerated_compute_metrics: true diff --git a/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml b/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml index b7ee0fa05d..7605fd96e6 100644 --- a/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml +++ b/translator/tocwconfig/sampleConfig/ignore_append_dimensions.yaml @@ -33,6 +33,7 @@ processors: platform: ec2 ec2tagger: imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_disk: diff --git a/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml b/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml index fa935efc58..caa5cfc15b 100644 --- a/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml +++ b/translator/tocwconfig/sampleConfig/invalid_input_linux.yaml @@ -39,6 +39,7 @@ processors: - InstanceId - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_disk: @@ -62,8 +63,8 @@ service: - awsentity/resource - ec2tagger receivers: - - telegraf_mem - telegraf_disk + - telegraf_mem telemetry: logs: development: false diff --git a/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml b/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml index 0288cfd3f5..73562f67a1 100644 --- a/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/jmx_config_linux.yaml @@ -136,11 +136,11 @@ processors: metric_statements: - context: metric statements: + - set(unit, "unit") where name == "disk_free" + - set(name, "DISK_FREE") where name == "disk_free" - set(unit, "unit") where name == "cpu_usage_idle" - set(name, "CPU_USAGE_IDLE") where name == "cpu_usage_idle" - set(unit, "unit") where name == "cpu_usage_nice" - - set(unit, "unit") where name == "disk_free" - - set(name, "DISK_FREE") where name == "disk_free" trace_statements: [] transform/jmx: error_mode: propagate diff --git a/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml b/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml index 5748189bcf..4f5db5136a 100644 --- a/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml +++ b/translator/tocwconfig/sampleConfig/otlp_metrics_config.yaml @@ -43,6 +43,7 @@ processors: - InstanceId - InstanceType imds_retries: 1 + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: otlp/metrics: diff --git a/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.yaml b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.yaml index b72fa23134..56d9630267 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.yaml @@ -163,7 +163,7 @@ receivers: enable_http2: true file_sd_configs: - files: - - {ecsSdFileName} + - {ecsSdFileName} refresh_interval: 5m follow_redirects: true honor_timestamps: true diff --git a/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.yaml b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.yaml index 3f40632557..4707009580 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.yaml @@ -74,7 +74,7 @@ receivers: enable_http2: true file_sd_configs: - files: - - {ecsSdFileName} + - {ecsSdFileName} refresh_interval: 5m follow_redirects: true honor_timestamps: true diff --git a/translator/tocwconfig/sampleConfig/standard_config_linux.yaml b/translator/tocwconfig/sampleConfig/standard_config_linux.yaml index 408ac96cc2..0298016500 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_linux.yaml @@ -48,6 +48,7 @@ processors: - ImageId - InstanceId - InstanceType + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_cpu: @@ -83,10 +84,10 @@ service: - awsentity/resource - ec2tagger receivers: - - telegraf_disk - - telegraf_mem - telegraf_swap - telegraf_cpu + - telegraf_disk + - telegraf_mem metrics/hostDeltaMetrics: exporters: - awscloudwatch diff --git a/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml b/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml index 49bb355dbd..145b8b9fa5 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_linux_with_common_config.yaml @@ -53,6 +53,7 @@ processors: - InstanceId - InstanceType imds_retries: 2 + middleware: agenthealth/statuscode profile: AmazonCloudWatchAgent refresh_interval_seconds: 0s shared_credential_file: fake-path diff --git a/translator/tocwconfig/sampleConfig/standard_config_windows.yaml b/translator/tocwconfig/sampleConfig/standard_config_windows.yaml index 338d389f00..0148dbbc95 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_windows.yaml @@ -38,6 +38,7 @@ processors: - ImageId - InstanceId - InstanceType + middleware: agenthealth/statuscode refresh_interval_seconds: 0s receivers: telegraf_win_perf_counters/1492679118: diff --git a/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml b/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml index 7f9949532e..abe8393a44 100644 --- a/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml +++ b/translator/tocwconfig/sampleConfig/standard_config_windows_with_common_config.yaml @@ -43,6 +43,7 @@ processors: - InstanceId - InstanceType imds_retries: 2 + middleware: agenthealth/statuscode profile: AmazonCloudWatchAgent refresh_interval_seconds: 0s shared_credential_file: fake-path @@ -85,11 +86,11 @@ service: - awsentity/resource - ec2tagger receivers: + - telegraf_win_perf_counters/4283769065 + - telegraf_win_perf_counters/1492679118 - telegraf_win_perf_counters/3610923661 - telegraf_win_perf_counters/3446270237 - telegraf_win_perf_counters/3762679655 - - telegraf_win_perf_counters/4283769065 - - telegraf_win_perf_counters/1492679118 telemetry: logs: development: false diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index 7d3b509d17..453c2b0879 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -9,6 +9,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/aws/amazon-cloudwatch-agent/tool/testutil" "io/fs" "os" "path/filepath" @@ -27,7 +28,6 @@ import ( "github.com/aws/amazon-cloudwatch-agent/cfg/commonconfig" "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" "github.com/aws/amazon-cloudwatch-agent/internal/retryer" - "github.com/aws/amazon-cloudwatch-agent/tool/testutil" "github.com/aws/amazon-cloudwatch-agent/translator" "github.com/aws/amazon-cloudwatch-agent/translator/cmdutil" "github.com/aws/amazon-cloudwatch-agent/translator/config" diff --git a/translator/translate/otel/extension/agenthealth/translator.go b/translator/translate/otel/extension/agenthealth/translator.go index 0088b309fb..506f3d2e9e 100644 --- a/translator/translate/otel/extension/agenthealth/translator.go +++ b/translator/translate/otel/extension/agenthealth/translator.go @@ -25,11 +25,10 @@ const ( ) var ( - MetricsID = component.NewIDWithName(agenthealth.TypeStr, component.DataTypeMetrics.String()) - LogsID = component.NewIDWithName(agenthealth.TypeStr, component.DataTypeLogs.String()) - TracesID = component.NewIDWithName(agenthealth.TypeStr, component.DataTypeTraces.String()) - StatusCodeID = component.NewIDWithName(agenthealth.TypeStr, "statuscode") - + MetricsID = component.NewIDWithName(agenthealth.TypeStr, component.DataTypeMetrics.String()) + LogsID = component.NewIDWithName(agenthealth.TypeStr, component.DataTypeLogs.String()) + TracesID = component.NewIDWithName(agenthealth.TypeStr, component.DataTypeTraces.String()) + StatusCodeID = component.NewIDWithName(agenthealth.TypeStr, "statuscode") ) type translator struct { diff --git a/translator/translate/otel/processor/ec2taggerprocessor/translator.go b/translator/translate/otel/processor/ec2taggerprocessor/translator.go index 898814b020..2add6ecf55 100644 --- a/translator/translate/otel/processor/ec2taggerprocessor/translator.go +++ b/translator/translate/otel/processor/ec2taggerprocessor/translator.go @@ -4,7 +4,6 @@ package ec2taggerprocessor import ( - "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth" "time" "go.opentelemetry.io/collector/component" @@ -15,6 +14,7 @@ import ( "github.com/aws/amazon-cloudwatch-agent/plugins/processors/ec2tagger" "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth" ) var Ec2taggerKey = common.ConfigKey(common.MetricsKey, common.AppendDimensionsKey)