---
title: Instrumenting Cloud Run Functions
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > Serverless > Google Cloud Run > Instrumenting Cloud Run Functions
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Instrumenting Cloud Run Functions

{% alert level="info" %}
**Looking for 1st gen Cloud Run functions?** If you're using Cloud Run functions (1st gen), previously known as Cloud Functions (1st gen), see [Instrumenting 1st Gen Cloud Run Functions](https://docs.datadoghq.com/serverless/google_cloud_run/functions_1st_gen.md).
{% /alert %}

## Set up with agentic onboarding{% #set-up-with-agentic-onboarding %}

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com



{% alert level="danger" %}
This feature is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md) ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}


{% /callout %}

Use agentic onboarding to set up monitoring for your Cloud Run functions 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:

- **Pup CLI**: Run `pup setup` from your terminal. It doesn't need your own coding assistant or AI model, so setup doesn't use your model tokens.
- **MCP server**: Set up from your IDE through a coding assistant such as Claude Code or Cursor.

{% tab title="Pup CLI" %}
Run `pup setup` in your project directory (requires Node.js 22+). It links your Datadog account, then instruments your Cloud Run function:

```shell
npx @datadog/pup setup --product serverless --serverless-compute-type=gcp-cloud-run-functions
```

Omit `--product` to run interactively, or add `--site` to target your Datadog site.
{% /tab %}

{% tab title="MCP server" %}
Use the Datadog MCP server's [`serverless_onboarding`](https://docs.datadoghq.com/agentic_onboarding/setup.md?tab=serverlessmonitoring#mcp-server) tool to set up monitoring for your Cloud Run functions with AI assistance. After you connect, try a prompt like:

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

{% /tab %}

## Manual instrumentation{% #manual-instrumentation %}

First, set up the [Datadog-Google Cloud Platform integration](https://docs.datadoghq.com/integrations/google-cloud-platform.md) to collect metrics and logs from Google Cloud services. Remember to add the `cloud asset viewer` role to your service account and enable the Cloud Asset Inventory API in Google Cloud.

Then, select your runtime below for instructions on how to instrument your application:

- [Python](https://docs.datadoghq.com/serverless/google_cloud_run/functions/python/)
- [Node.js](https://docs.datadoghq.com/serverless/google_cloud_run/functions/nodejs/)
- [go](https://docs.datadoghq.com/serverless/google_cloud_run/functions/go/)
- [Java](https://docs.datadoghq.com/serverless/google_cloud_run/functions/java/)
- [.NET](https://docs.datadoghq.com/serverless/google_cloud_run/functions/dotnet/)
- [Ruby](https://docs.datadoghq.com/serverless/google_cloud_run/functions/ruby/)
 
## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Cloud Functions is now Cloud Run functions — event-driven programming in one unified serverless platform](https://cloud.google.com/blog/products/serverless/google-cloud-functions-is-now-cloud-run-functions)
- [Datadog MCP Server: serverless_onboarding tool](https://docs.datadoghq.com/mcp_server/tools.md#serverless_onboarding)
