
Implementing Observability on AWS with Datadog to Detect Issues and Identify Root Causes
Learn how to connect AWS metrics, application traces, and logs with Datadog, then use release context and a real checkout investigation to narrow down a payment configuration failure. Issue detection and root-cause analysis are just two of Datadog’s many capabilities.
Series: Observability (1 article)
- 1Implementing Observability on AWS with Datadog to Detect Issues and Identify Root Causes This article
AWS Community Builder | AWS Ambassador
An application can pass its health checks while a critical user journey fails. Finding the cause requires more than a CPU chart: we need to connect infrastructure metrics, application traces, logs, and release context.
Detecting issues and identifying root causes are just two of Datadog's many capabilities. This article focuses on that workflow: implementing observability for an AWS application, then using it to investigate a checkout failure involving payment configuration.
1. Architecture and prerequisites
The reference architecture uses an Application Load Balancer, a Rails application on Amazon EKS with EC2 worker nodes, and MongoDB on private EC2. The application also calls an external payment provider.
Datadog Agents collect application traces, container logs, and node metrics. The AWS integration supplies cloud-level metrics. These telemetry paths are separate from customer requests.
]
You need an existing Rails application and EKS cluster, Helm and kubectl access, and a Datadog organization with APM and Logs enabled. This architecture is the tutorial's chosen deployment model; the screenshots document application behavior rather than prove the exact network topology.
2. Install the Datadog Agent
Connect your AWS account through Datadog's AWS integration workflow and enable the relevant Region and ALB/EC2 metrics. Review the delegated IAM permissions and confirm that the expected resources appear.
For the EKS Agent, provision a Kubernetes Secret named
datadog-secret in the monitoring namespace, containing the Datadog API key under api-key . Use your approved secret-management process; do not put credentials in a repository.Create
datadog-values.yaml :datadog: apiKeyExistingSecret: datadog-secret site: datadoghq.com clusterName: shopist-eks logs: enabled: true containerCollectAll: false apm: portEnabled: true env: - name: DD_APM_NON_LOCAL_TRAFFIC value: "true"clusterAgent: enabled: trueReplace the site and cluster name with your values, then install:
helm repo add datadog https://helm.datadoghq.comhelm repo updatehelm upgrade --install datadog datadog/datadog \ --namespace monitoring --create-namespace \ -f datadog-values.yaml
kubectl -n monitoring get daemonsets,podsConfirm an Agent runs on each application node and can reach your Datadog site's intake endpoints. This example sends traces to the local node over TCP 8126. Keep that port private and restrict access to authorized workloads. Pin a tested Helm chart version for repeatable deployments.
3. Instrument Rails and correlate logs
Add the supported Datadog Ruby gem to your application and lock the tested version:
# Gemfilegem 'datadog', require: 'datadog/auto_instrument'Configure the application container:
env: - name: DD_AGENT_HOST valueFrom: fieldRef: fieldPath: status.hostIP - name: DD_SERVICE value: web-store - name: DD_ENV value: prod - name: DD_VERSION value: RELEASE_ID - name: DD_LOGS_INJECTION value: "true"Replace
RELEASE_ID with your deployment identifier. Use a separate environment tag for staging. Add matching labels and log collection configuration to the Pod template:metadata: labels: tags.datadoghq.com/env: prod tags.datadoghq.com/service: web-store tags.datadoghq.com/version: RELEASE_ID annotations: ad.datadoghq.com/web-store.logs: >- [{"source":"ruby","service":"web-store"}]The annotation assumes the container is named
web-store . Configure Rails to write logs to stdout. Verify that your logger preserves Datadog correlation fields and that the log pipeline parses trace IDs correctly; configure a Trace Remapper if needed.Deploy the instrumented application, send a normal request, and check three things: the Rails trace appears, MongoDB driver spans are visible, and related logs open from the trace. Supported integrations depend on the libraries your application uses.
4. Start with symptoms, then compare releases
In the captured Service Summary,
web-store shows 47.0k requests and 9.79k errors. The Changes lane also contains deployment markers. These observations justify investigating releases, but do not establish causation.
Open the Versions comparison. The newest row has a 32.1% error rate and 521ms p95, while the next-newest has an 18.1% error rate and 658ms p95. Lower latency does not necessarily mean a healthier release: failures may return quickly, and the request mix may differ.
Several versions are active, so the next step is to identify which release handled a specific failed request rather than automatically blaming the newest version. Use comparable resource filters and time windows when evaluating release-level behavior.
5. Follow one failed request to its exception
The selected
POST /checkout returns HTTP 500 after approximately 1.29 seconds. Its Overview attributes identify:- Service:
web-store
- Environment:
prod
- Version:
vab173011ef-582559
- Start time:
2026-11-17T02:06:59.163Z
The version matches the row with an 18.1% error rate. This links the transaction to a release, but the release-wide error rate does not mean every request fails in the same way.
Select
ShoppingCartController#checkout and open Errors. The application reports:UnhandledInternalServiceError:Unhandled internal error: Uncaught exception - payment rejectedfor transaction due to API key misconfiguration.The stack points to
charge_payment in shopping_cart_controller.rb . This redirects the investigation toward payment configuration rather than immediately tuning MongoDB queries.
The waterfall contains many MongoDB spans, including an aggregate taking 64.9ms. That alone does not prove N+1 or explain the HTTP 500. Also, this request is marked p44; it should not be used to explain the separate high-p95 GET requests in the service overview.
6. Use related logs to test competing explanations
The trace's Logs panel contains 43 related entries. One warns that database connection-pool health is degraded because of stale connections.
That warning deserves investigation, but it does not override the more specific payment-key exception. Trace/log correlation keeps both messages within the same transaction context, helping distinguish a relevant failure from a concurrent warning.
At this point, Datadog has narrowed the investigation to a particular release, request, and payment code path. The next action is to inspect that release's runtime payment configuration.
7. Inspect configuration and verify the correction
A release can change a Secret reference without changing business code. For example, the payment client might still call a live endpoint while a deployment selects a sandbox credential:
# Intended configurationsecretKeyRef: name: payment-live-current key: api-key
# A possible release mistake:# name: payment-sandbox-currentThis is an illustrative failure mechanism, not a configuration change proven by the screenshots. Compare release
vab173011ef-582559 with the intended configuration: check the Secret reference, credential revision, variable name, and payment endpoint/environment. Inspect the gateway's sanitized error classification if available. Never log the key or Authorization header.After identifying the mismatch, correct it through the release process. If credentials enter the container as environment variables, updating the Secret alone will not refresh an already-running process; roll out the intended workload revision.
Verify with a new transaction trace, the repaired release tag, the correct business outcome, and checkout-specific error monitoring. Use sandbox payments or an approved validation procedure, and respect payment idempotency before retrying transactions.
No repaired trace was available for this walkthrough, so recovery is described as a verification procedure rather than a claimed result.
Conclusion
Datadog connects service symptoms, release context, traces, and logs into one investigation. Here, that workflow identifies a failed checkout in
vab173011ef-582559 and a payment-key configuration exception, giving the operator a precise configuration boundary to inspect.The broader lesson is to implement correlation before an incident. Metrics show the symptom; traces locate the failing operation; logs and release metadata help explain its context. Together, they support root-cause investigation without assuming that the newest build or every nearby warning caused the failure.
References
Series: Observability (1 article)
- 1Implementing Observability on AWS with Datadog to Detect Issues and Identify Root Causes This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations






Loading article