This document is relevant for: Trn2, Trn3

How to configure Neuron Observer metrics export#

Overview#

The Neuron Observer daemon always serves Prometheus metrics from /metrics on port 7001. For Amazon Managed Service for Prometheus (AMP) and Amazon CloudWatch, the Helm chart also deploys a co-located OpenTelemetry collector on each node, and the daemon pushes metrics to it.

This page covers one backend per section. Read the section for the backend you use:

Note

Neuron Observer is in public beta. APIs, metric names, and installation steps can change before general availability.

Prerequisites#

  • Neuron Observer installed on your cluster. See How to install and configure Neuron Observer on Amazon EKS.

  • One or more export destinations:

    • Prometheus installed in-cluster to scrape the daemon’s native /metrics endpoint.

    • An AMP workspace and IAM permission for aps:RemoteWrite, reachable from the collector pod through Pod Identity or IRSA.

    • IAM permissions for CloudWatch metrics and logs, reachable from the collector pod through Pod Identity or IRSA.

  • AWS Distro for OpenTelemetry (ADOT) EKS add-on (installs the OpenTelemetry Operator, required only for the AMP and CloudWatch options). The OpenTelemetry collector section installs it.

Configure Prometheus scraping#

When the Prometheus Operator CRD is installed, the install command creates a PodMonitor that points Prometheus at the daemon’s native /metrics endpoint. With the kube-prometheus-stack release name used in the quickstart, no extra scrape configuration is required.

If your Prometheus installation does not use the Prometheus Operator or does not select this PodMonitor, add a scrape job:

- job_name: neuron-observer
  kubernetes_sd_configs:
    - role: pod
      namespaces:
        names:
          - neuron-observer
  relabel_configs:
    - source_labels: [__meta_kubernetes_pod_label_app_kubernetes_io_name]
      regex: neuron-observer
      action: keep
    - source_labels: [__meta_kubernetes_pod_ip]
      regex: (.+)
      replacement: ${1}:7001
      target_label: __address__
    - source_labels: [__meta_kubernetes_pod_node_name]
      target_label: node
  metrics_path: /metrics
  scrape_interval: 30s

With kube-prometheus-stack, apply the job as an additional scrape configuration. The file must be a bare YAML list (starting with - job_name:), not wrapped in a scrape_configs: key.

helm upgrade prometheus prometheus-community/kube-prometheus-stack \
  --namespace monitoring --reuse-values \
  --set-file prometheus.prometheusSpec.additionalScrapeConfigs=neuron-observer-scrape.yaml

Verify that Prometheus scrapes the targets about 30 seconds after you apply the configuration:

kubectl port-forward -n monitoring \
  svc/prometheus-kube-prometheus-prometheus 9090:9090

In another terminal:

curl -s "http://localhost:9090/api/v1/query?query=neuron_system_neuron_device_count"

The response contains "status":"success" and results with your node’s instance_id.

Set up the OpenTelemetry collector (AMP and CloudWatch)#

AMP and CloudWatch export use an OpenTelemetry collector that the chart deploys as an OpenTelemetryCollector custom resource. Complete both steps once; then continue with the AMP or CloudWatch section. Skip this section if you use only Prometheus.

1: Install the ADOT operator

Install the OpenTelemetry Operator on EKS with the ADOT EKS add-on.

# Install cert-manager (required by the operator)
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.17.0/cert-manager.yaml

# Wait for cert-manager to be ready
kubectl wait --for=condition=Available deployment/cert-manager -n cert-manager --timeout=120s
kubectl wait --for=condition=Available deployment/cert-manager-webhook -n cert-manager --timeout=120s

# Install the ADOT EKS add-on
aws eks create-addon --cluster-name <your-cluster-name> --addon-name adot --region <your-region>

Verify the operator is running:

kubectl get pods -n opentelemetry-operator-system
# Expected: one pod in Running state

If you already have the ADOT add-on or the OpenTelemetry Operator installed, skip this step.

2: Create the collector IAM role

The ADOT collector requires AWS permissions to push metrics to AMP or CloudWatch. Grant the permissions through EKS Pod Identity to the neuron-observer-otel service account.

# Install the EKS Pod Identity Agent add-on
aws eks create-addon --cluster-name <your-cluster-name> --region <REGION> \
  --addon-name eks-pod-identity-agent
aws eks wait addon-active --cluster-name <your-cluster-name> --region <REGION> \
  --addon-name eks-pod-identity-agent

# Create the IAM role the collector assumes via Pod Identity.
# The trust policy allows pods.eks.amazonaws.com to assume it.
cat > /tmp/trust.json <<'EOF'
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {"Service": "pods.eks.amazonaws.com"},
    "Action": ["sts:AssumeRole", "sts:TagSession"]
  }]
}
EOF
aws iam create-role --role-name neuron-observer-pod-identity \
  --assume-role-policy-document file:///tmp/trust.json

Attach permissions for the pipeline you use. For AMP, grant aps:RemoteWrite on the AMP workspace ARN. For CloudWatch, grant cloudwatch:PutMetricData (optionally scoped to the NeuronObserver namespace) plus CloudWatch Logs permissions. The AMP and CloudWatch sections below show the policy for each.

The collector uses this role through the neuron-observer-otel service account.

Export to Amazon Managed Service for Prometheus#

Requires the OpenTelemetry collector setup above.

1: Attach the AMP permissions to the collector role

# AMP permissions example
cat > /tmp/amp-policy.json <<EOF
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": ["aps:RemoteWrite"],
    "Resource": "<AMP_WORKSPACE_ARN>"
  }]
}
EOF
aws iam put-role-policy --role-name neuron-observer-pod-identity \
  --policy-name neuron-observer-amp-permissions \
  --policy-document file:///tmp/amp-policy.json

2: Enable the AMP pipeline

Rerun the install command from How to install and configure Neuron Observer on Amazon EKS with the AMP pipeline flags. $CHART, $CHART_VERSION, and $COMMON are defined there.

helm upgrade --install neuron-observer $CHART \
  --version $CHART_VERSION \
  --namespace neuron-observer --create-namespace \
  $COMMON \
  --set observer.enabled=true \
  --set observer.daemon.config.export.enabled=true \
  --set observer.otelDaemonCollector.pipelines.amp.enabled=true \
  --set observer.otelDaemonCollector.pipelines.amp.endpoint=https://aps-workspaces.<REGION>.amazonaws.com/workspaces/<WORKSPACE_ID>/api/v1/remote_write \
  --set observer.otelDaemonCollector.awsRegion=<REGION>

3: Bind the collector role to the service account

aws eks create-pod-identity-association \
  --cluster-name <your-cluster-name> --region <REGION> \
  --namespace neuron-observer --service-account neuron-observer-otel \
  --role-arn <collector-role-arn>

4: Verify that the collector pods are running

# ADOT-managed OTel collector pods (one per Trainium node)
kubectl get pods -n neuron-observer \
  -l app.kubernetes.io/managed-by=opentelemetry-operator

Export to Amazon CloudWatch#

Requires the OpenTelemetry collector setup above.

1: Attach the CloudWatch permissions to the collector role

# CloudWatch permissions example
cat > /tmp/policy.json <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"],
      "Resource": "arn:aws:logs:<REGION>:<ACCOUNT>:log-group:/metrics/neuron-observer*"
    },
    {
      "Effect": "Allow",
      "Action": ["cloudwatch:PutMetricData"],
      "Resource": "*",
      "Condition": {"StringLike": {"cloudwatch:namespace": "NeuronObserver*"}}
    }
  ]
}
EOF
aws iam put-role-policy --role-name neuron-observer-pod-identity \
  --policy-name neuron-observer-cloudwatch-permissions \
  --policy-document file:///tmp/policy.json

2: Enable the CloudWatch pipeline

Rerun the install command from How to install and configure Neuron Observer on Amazon EKS with the CloudWatch pipeline flags. $CHART, $CHART_VERSION, and $COMMON are defined there.

helm upgrade --install neuron-observer $CHART \
  --version $CHART_VERSION \
  --namespace neuron-observer --create-namespace \
  $COMMON \
  --set observer.enabled=true \
  --set observer.daemon.config.export.enabled=true \
  --set observer.otelDaemonCollector.pipelines.cloudwatch.enabled=true \
  --set observer.otelDaemonCollector.awsRegion=<REGION>

3: Bind the collector role to the service account

aws eks create-pod-identity-association \
  --cluster-name <your-cluster-name> --region <REGION> \
  --namespace neuron-observer --service-account neuron-observer-otel \
  --role-arn <collector-role-arn>

4: Verify that the collector pods are running and CloudWatch receives data

# ADOT-managed OTel collector pods (one per Trainium node)
kubectl get pods -n neuron-observer \
  -l app.kubernetes.io/managed-by=opentelemetry-operator

# Verify — one entry per node, keyed by instance_id
aws cloudwatch list-metrics --region <REGION> --namespace NeuronObserver \
  --metric-name neuron.system.neuron_device_count

To query a metric:

# CloudWatch CLI example for getting metrics.
# Uncorrectable HBM ECC events are aggregated per node, so this metric
# carries the instance_id dimension only (no per-device dimension).
# CloudWatch metric names use the dotted form.
aws cloudwatch get-metric-statistics \
  --namespace NeuronObserver \
  --metric-name neuron.device.mem_ecc_uncorrected.sum \
  --dimensions Name=instance_id,Value=<instance-id> \
  --statistics Sum --period 60 \
  --start-time "<one-hour-ago-UTC>" --end-time "<current-time-UTC>"

CloudWatch dashboards

Neuron Observer includes CloudWatch dashboard definitions. The cluster overview shows node and device counts, NeuronCore utilization, inference activity, memory usage, hardware errors, device health, and EFA reliability. The per-node diagnostics dashboard shows these signals, including EFA metrics, for one node.

Amazon CloudWatch cluster overview dashboard for Neuron Observer showing active nodes, devices, and NeuronCores, average core utilization, core utilization and host CPU by node, host and cluster memory usage, and EFA network traffic, packets, per-node throughput, drops, RDMA errors, retransmits, and link health.

Fig. 157 Sample Amazon CloudWatch dashboard.#