For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/serverless/google_cloud_run/containers.md. A documentation index is available at /llms.txt.

Choosing an Instrumentation Method for Containers

Set up with agentic onboarding

Use agentic onboarding to set up monitoring for your Cloud Run containers with AI assistance. Agentic onboarding detects your project’s frameworks, applies the required configuration in place, and verifies that data is flowing. Two complementary paths use the same Datadog account:

  • AI Setup CLI: A standalone terminal tool. Use it when you don’t want to install an MCP server.
  • MCP server: Set up from your IDE through a coding assistant such as Claude Code or Cursor.

Run the CLI in your project directory (requires Node.js 22+). It links your Datadog account, then instruments your Cloud Run service:

npx @datadog/ai-setup-cli --product serverless --serverless-compute-type=gcp-cloud-run

Omit --product to run interactively, or add --site to target your Datadog site.

Use the Datadog MCP server’s serverless_onboarding tool to set up monitoring for your Cloud Run containers with AI assistance. After you connect, try a prompt like:

Help me monitor my GCP Cloud Run services with Datadog using Terraform.

Manual instrumentation

To instrument your Google Cloud Run containers with Datadog, choose one of two options:


  • In-Container: Wraps your application container with the Datadog Agent. Choose this option for a simpler setup, lower cost overhead, and direct log piping.
  • Sidecar: Deploys the Datadog Agent in a separate container alongside your app container. Choose this option if you have multiple containers in a single service, if you prefer strict isolation of the Datadog Agent, or if you have performance-sensitive workloads.

Comparison: In-Container versus sidecar instrumentation

AspectIn-ContainerSidecar
DeploymentOne container (your app, wrapped with the Datadog Agent)Two containers (your app, Datadog Agent)
Image changesIncreases app image size.No change to app image.
Cost overheadLess than sidecar (no extra container).Extra vCPU/memory. Overallocating the sidecar wastes cost; underallocating leads to premature scaling.
LoggingDirect stdout/stderr access.Shared volume + log library routing to a log file. Uncaught errors require extra handling, since they are not automatically handled by your logging library.
Failure isolationIn rare cases, Datadog Agent bugs can affect your app.Datadog Agent faults are isolated.

Further reading