Skip to content

[Cloud Run] Split up In-Process docs #30742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
be6fbd9
update containers overview page with tabs
nhulston Jul 28, 2025
9980e70
create empty pages for each in-process language
nhulston Jul 28, 2025
b3562b8
fill out nodejs in-process
nhulston Jul 28, 2025
e5a83d8
fix layout
nhulston Jul 28, 2025
a92a866
fix layout
nhulston Jul 28, 2025
3b28600
cleanup nodejs page; fix links
nhulston Jul 28, 2025
e71bead
reorganize files
nhulston Jul 28, 2025
6cf5073
add configuration section
nhulston Jul 28, 2025
c1241d7
update tab structure
nhulston Jul 28, 2025
ed939e0
add python instructions
nhulston Jul 28, 2025
46c3aa5
remove empty page
nhulston Jul 28, 2025
9093187
make explanation and alternative configuration collapsible
nhulston Jul 28, 2025
bf98893
fix `gcloud run deploy` shell
nhulston Jul 28, 2025
574a44e
fix expandable content
nhulston Jul 28, 2025
be52fa5
fix languages tabs at top
nhulston Jul 28, 2025
eee4c20
update collapsible
nhulston Jul 28, 2025
c66b10e
fix links; update collapsible
nhulston Jul 28, 2025
8c83b3e
nits
nhulston Jul 28, 2025
2bd7ec9
add more information to "Alternative configuration"
nhulston Jul 28, 2025
75cccfe
Merge branch 'master' into nicholas.hulston/gcr-split-up-in-process-docs
nhulston Jul 29, 2025
32c2334
Update description for `DD_SOURCE` and `DD_TAGS`; make `COPY` explana…
nhulston Jul 29, 2025
996c479
Move `NODE_OPTIONS` to tracer installation instructions
nhulston Jul 29, 2025
bb695fc
clarify DD_SITE
nhulston Jul 29, 2025
962038f
fill in `go.md`
nhulston Jul 29, 2025
d006de5
nits go.md
nhulston Jul 29, 2025
a2f274d
try using hugo shortcodes to simplify step 2
nhulston Jul 30, 2025
4365633
try to fix shortcode
nhulston Jul 30, 2025
6e67232
Reorder languages
nhulston Jul 30, 2025
b80aec1
Fix nested shortcode
nhulston Jul 30, 2025
a4b77f2
fix escaped quotes
nhulston Jul 30, 2025
908c660
update go and nodejs to use shortcode
nhulston Jul 30, 2025
a64a11d
implement java.md
nhulston Jul 30, 2025
8109198
nits
nhulston Jul 30, 2025
749aa7d
implement dotnet.md
nhulston Jul 30, 2025
e40d1ff
nits
nhulston Jul 30, 2025
ac753da
implement ruby.md
nhulston Jul 30, 2025
4c621cc
implement php.md
nhulston Jul 31, 2025
8175816
add troubleshooting instructions
nhulston Jul 31, 2025
8260220
add google cloud integration setup
nhulston Jul 31, 2025
31843f2
add more info about serverless-init image and tags
nhulston Jul 31, 2025
82cc8f9
fix markdown link
nhulston Jul 31, 2025
356b524
add aliases for old paths
nhulston Jul 31, 2025
46578e6
Merge branch 'master' into nicholas.hulston/gcr-split-up-in-process-docs
nhulston Jul 31, 2025
622bcec
add `DD_SOURCE=nodejs` recommendation
nhulston Jul 31, 2025
472be85
update titles
nhulston Jul 31, 2025
4a09b8c
Add software catalog troubleshooting and mark required env vars as re…
nhulston Jul 31, 2025
1c12c60
fix link
nhulston Jul 31, 2025
3d819e6
optimize PHP dockerfile by combining RUN instructions
nhulston Jul 31, 2025
cb81da2
nits
nhulston Aug 4, 2025
59cc524
Only show relevant language docs in configure env vars table
nhulston Aug 4, 2025
1302b66
fix table
nhulston Aug 4, 2025
c3cf8b0
formatting
cswatt Aug 6, 2025
56c509f
install the tracer
cswatt Aug 6, 2025
ff23e05
small edit
cswatt Aug 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: Choosing an Instrumentation Method for Google Cloud Run Containers
title: Choosing an Instrumentation Method for Containers
Comment on lines 1 to +2
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including "Google Cloud Run" in each subpage was getting very redundant; here's what it looks like now:

Screenshot 2025-07-31 at 1 16 08 PM

further_reading:
- link: "/integrations/google-cloud-run/"
tag: "Documentation"
text: "Google Cloud Run Integration"
- link: 'https://www.datadoghq.com/blog/collect-traces-logs-from-cloud-run-with-datadog/'
tag: 'Blog'
text: 'Collect traces, logs, and custom metrics from Cloud Run services'
- link: "/serverless/google_cloud_run/containers_in_process/"
- link: "/serverless/google_cloud_run/containers/in_process/"
tag: 'Documentation'
text: 'Instrument your container with the in-process approach'
- link: "/serverless/google_cloud_run/containers_sidecar/"
- link: "/serverless/google_cloud_run/containers/sidecar/"
tag: 'Documentation'
text: 'Instrument your container with the sidecar approach'
---
Expand All @@ -19,7 +19,7 @@ To instrument your Google Cloud Run containers with Datadog, choose one of two o

{{% google-cloud-run-container-options %}}

- [**In-process**][1]: Wraps your application container with the Datadog Agent. Choose this option for a simpler setup, lower cost overhead, and direct log piping.
- [**In-process**][1]: Wraps your application container with the Datadog Agent. Choose this option for a simpler setup, lower cost overhead, and direct log piping.
- [**Sidecar**][2]: 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-process versus sidecar instrumentation
Expand All @@ -38,5 +38,5 @@ To instrument your Google Cloud Run containers with Datadog, choose one of two o

{{< partial name="whats-next/whats-next.html" >}}

[1]: /serverless/google_cloud_run/containers_in_process
[2]: /serverless/google_cloud_run/containers_sidecar
[1]: /serverless/google_cloud_run/containers/in_process
[2]: /serverless/google_cloud_run/containers/sidecar
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: In-Process Instrumentation
type: multi-code-lang
aliases:
- /serverless/google_cloud_run/containers_in_process/
---

First, set up the [Google Cloud Integration][1] 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, instrument your application using one of the following guides:

{{< partial name="serverless/in-process-languages.html" >}}

[1]: /integrations/google-cloud-platform/
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: Instrumenting a .NET Cloud Run Container In-Process
code_lang: dotnet
type: multi-code-lang
code_lang_weight: 50
further_reading:
- link: '/tracing/trace_collection/automatic_instrumentation/dd_libraries/dotnet-core/?tab=linux'
tag: 'Documentation'
text: 'Tracing .NET Core Applications'
- link: '/tracing/other_telemetry/connect_logs_and_traces/dotnet/'
tag: 'Documentation'
text: 'Correlating .NET Logs and Traces'
---

## 1. Install the Tracer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have public sample apps we can link to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we decided not to link to sample apps? I will ask Piyali

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay got confirmation, we can link them!


Install the tracer in your Dockerfile. Note that GitHub requests are rate limited, so pass a Github token saved in the environment variable `GITHUB_TOKEN` as a [Docker build secret][1] `--secret id=github-token,env=GITHUB_TOKEN`.

For linux/amd64, include:
```Dockerfile
RUN --mount=type=secret,id=github-token,env=GITHUB_TOKEN \
chmod +x /app/dotnet.sh && /app/dotnet.sh \
```

For alpine builds, configure your Dockerfile like so:

```Dockerfile
# For arm64 use datadog-dotnet-apm-2.57.0.arm64.tar.gz
# For alpine use datadog-dotnet-apm-2.57.0-musl.tar.gz
ARG TRACER_VERSION
ADD https://github.com/DataDog/dd-trace-dotnet/releases/download/v${TRACER_VERSION}/datadog-dotnet-apm-${TRACER_VERSION}.tar.gz /tmp/datadog-dotnet-apm.tar.gz

RUN mkdir -p /dd_tracer/dotnet/ && tar -xzvf /tmp/datadog-dotnet-apm.tar.gz -C /dd_tracer/dotnet/ && rm /tmp/datadog-dotnet-apm.tar.gz
```

For more information, see [Tracing .NET applications][2].

## 2. Install Serverless-Init

{{% gcr-install-serverless-init cmd="\"dotnet\", \"dotnet.dll\"" %}}

## 3. Setup Logs

To enable logging, set the environment variable `DD_LOGS_ENABLED=true`. This allows serverless-init to read logs from stdout and stderr.

We also recommend setting the environment variable `DD_SOURCE=csharp` to enable advanced Datadog log parsing.

If you want multiline logs to be preserved in a single log message, we recommend writing your logs in JSON format. For example, you can use a third-party logging library such as `Serilog`:
```csharp
using Serilog;

builder.Host.UseSerilog((context, config) =>
{
config.WriteTo.Console(new Serilog.Formatting.Json.JsonFormatter(renderMessage: true));
});

logger.LogInformation("Hello World!");
```

For more information, see [Correlating .NET Logs and Traces][3].

## 4. Configure your application

{{% gcr-configure-env-vars %}}

## Troubleshooting

{{% gcr-troubleshooting %}}

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: https://docs.docker.com/build/building/secrets/
[2]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/dotnet-core/?tab=linux
[3]: /tracing/other_telemetry/connect_logs_and_traces/dotnet/
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: Instrumenting a Go Cloud Run Container In-Process
code_lang: go
type: multi-code-lang
code_lang_weight: 30
further_reading:
- link: '/tracing/trace_collection/automatic_instrumentation/dd_libraries/go/'
tag: 'Documentation'
text: 'Tracing Go Applications'
- link: '/tracing/other_telemetry/connect_logs_and_traces/go/'
tag: 'Documentation'
text: 'Correlating Go Logs and Traces'
---

## 1. Install the Tracer

In your main application, add the tracing library from `dd-trace-go`.

```shell
go get github.com/DataDog/dd-trace-go/v2/ddtrace/tracer
```

Then, add this to your application code to initialize the tracer:
```go
tracer.Start()
defer tracer.Stop()
```

You can also add additional packages:
```shell
# Enable Profiling
go get github.com/DataDog/dd-trace-go/v2/profiler

# Patch /net/http
go get github.com/DataDog/dd-trace-go/contrib/net/http/v2
```

For more information, see [Tracing Go Applications][1] and the [Tracer README][2].

## 2. Install Serverless-Init

{{% gcr-install-serverless-init cmd="./your-binary" %}}

## 3. Setup Logs

To enable logging, set the environment variable `DD_LOGS_ENABLED=true`. This allows serverless-init to read logs from stdout and stderr.

We also recommend setting the environment variable `DD_SOURCE=go` to enable advanced Datadog log parsing.

If you want multiline logs to be preserved in a single log message, we recommend writing your logs in JSON format. For example, you can use a third-party logging library such as `logrus`:
```go
logrus.SetFormatter(&logrus.JSONFormatter{})
logrus.AddHook(&dd_logrus.DDContextLogHook{})

logrus.WithContext(ctx).Info("Hello World!")
```

For more information, see [Correlating Go Logs and Traces][3].

## 4. Configure your application

{{% gcr-configure-env-vars %}}

## Troubleshooting

{{% gcr-troubleshooting %}}

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/go/
[2]: https://github.com/DataDog/dd-trace-go?tab=readme-ov-file#installing
[3]: /tracing/other_telemetry/connect_logs_and_traces/go/
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: Instrumenting a Java Cloud Run Container In-Process
code_lang: java
type: multi-code-lang
code_lang_weight: 40
further_reading:
- link: '/tracing/trace_collection/automatic_instrumentation/dd_libraries/java/'
tag: 'Documentation'
text: 'Tracing Java Applications'
- link: '/tracing/other_telemetry/connect_logs_and_traces/java/'
tag: 'Documentation'
text: 'Correlating Java Logs and Traces'
---

## 1. Install the Tracer

Add the Java tracer agent to your Dockerfile:

```dockerfile
ADD 'https://dtdg.co/latest-java-tracer' agent.jar
ENV JAVA_TOOL_OPTIONS="-javaagent:agent.jar"
```

Then, add the tracer artifacts.

Maven:
```xml
<dependency>
<groupId>com.datadoghq</groupId>
<artifactId>dd-trace-api</artifactId>
<version>DD_TRACE_JAVA_VERSION_HERE</version>
</dependency>
```

Gradle:
```groovy
implementation 'com.datadoghq:dd-trace-api:DD_TRACE_JAVA_VERSION_HERE'
```

Finally, add the `@Trace` annotation to any method you want to trace.

For more information, see [Tracing Java Applications][1].

## 2. Install Serverless-Init

{{% gcr-install-serverless-init cmd="\"./mvnw\", \"spring-boot:run\"" %}}

## 3. Setup Logs

To enable logging, set the environment variable `DD_LOGS_ENABLED=true`. This allows serverless-init to read logs from stdout and stderr.

We also recommend setting the environment variable `DD_SOURCE=java` to enable advanced Datadog log parsing.

If you want multiline logs to be preserved in a single log message, we recommend writing your logs in *compact* JSON format. For example, you can use a third-party logging library such as `Log4j 2`:
```java
private static final Logger logger = LogManager.getLogger(App.class);
logger.info("Hello World!");
```
`resources/log4j2.xml`:
```xml
<Configuration>
<Appenders>
<Console name="Console"><JsonLayout compact="true" eventEol="true" properties="true"/></Console>
</Appenders>
<Loggers><Root level="info"><AppenderRef ref="Console"/></Root></Loggers>
</Configuration>
```

For more information, see [Correlating Java Logs and Traces][2].

## 4. Configure your application

{{% gcr-configure-env-vars %}}

## Troubleshooting

{{% gcr-troubleshooting %}}

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/java/
[2]: /tracing/other_telemetry/connect_logs_and_traces/java/
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: Instrumenting a Node.js Cloud Run Container In-Process
code_lang: nodejs
type: multi-code-lang
code_lang_weight: 20
further_reading:
- link: '/tracing/trace_collection/automatic_instrumentation/dd_libraries/nodejs/'
tag: 'Documentation'
text: 'Tracing Node.js Applications'
- link: '/tracing/other_telemetry/connect_logs_and_traces/nodejs/'
tag: 'Documentation'
text: 'Correlating Node.js Logs and Traces'
---

## 1. Install the Tracer

In your main application, add the `dd-trace-js` library.

```shell
npm install dd-trace --save
```

Then, add this to your application code to initialize the tracer:
```javascript
const tracer = require('dd-trace').init({
logInjection: true,
});
```

Finally, set the following environment variable to specify that the `dd-trace/init` module is required when the Node.js process starts:
```dockerfile
ENV NODE_OPTIONS="--require dd-trace/init"
```

For more information, see [Tracing Node.js applications][1].

## 2. Install Serverless-Init

{{% gcr-install-serverless-init cmd="\"/nodejs/bin/node\", \"/path/to/your/app.js\"" %}}

## 3. Setup Logs

To enable logging, set the environment variable `DD_LOGS_ENABLED=true`. This allows serverless-init to read logs from stdout and stderr.

We also recommend setting the environment variable `DD_SOURCE=nodejs` to enable advanced Datadog log parsing.

If you want multiline logs to be preserved in a single log message, we recommend writing your logs in JSON format. For example, you can use a third-party logging library such as `winston`:
```javascript
const tracer = require('dd-trace').init({
logInjection: true,
});
const { createLogger, format, transports } = require('winston');

const logger = createLogger({
level: 'info',
exitOnError: false,
format: format.json(),
transports: [
new transports.Console()
],
});

logger.info(`Hello world!`);
```

For more information, see [Correlating Node.js Logs and Traces][2].

## 4. Configure your application

{{% gcr-configure-env-vars %}}

## Troubleshooting

{{% gcr-troubleshooting %}}

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: /tracing/trace_collection/automatic_instrumentation/dd_libraries/nodejs/
[2]: /tracing/other_telemetry/connect_logs_and_traces/nodejs/
Loading
Loading