CloudWatch agent is running but no custom metrics appear in the `CWAgent` namespace
BeginnerTroubleshootingTracing, OpenTelemetry and CloudWatch
Answer
Likely causes → IAM role lacks cloudwatch:PutMetricData, the agent runs with the default config (not yours), or you're looking in the wrong region.
Diagnose →
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a status
sudo tail -50 /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
Fix → Attach CloudWatchAgentServerPolicy to the instance role, then load your config:
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
-a fetch-config -m ec2 -s -c file:/opt/aws/amazon-cloudwatch-agent/etc/config.json
Prevent → Bake agent + config into the AMI or SSM State Manager association.
More on Tracing, OpenTelemetry and CloudWatch
Traces show only the frontend span; downstream services start new tracesIntermediateTraces break at the API gateway / ingress controllerIntermediateNo traces at all arrive; the app logs `Failed to export spans. The request could not be executed. Full error message: Failed to connect to localhost/127.0.0.1:4317`BeginnerSDK error `Unimplemented` / `404 Not Found` when exporting to the collectorIntermediateOTel collector logs `Exporting failed. Will retry the request after interval. {"kind": "exporter", "data_type": "traces", "name": "otlp", "error": "rpc error: code = Unavailable desc = connection error"}`IntermediateCollector logs `Dropping data because sending_queue is full`Advanced