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 all 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,80 @@
---
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'
---

## Setup
1. **Install the Datadog .NET tracer** in your Dockerfile.

Because GitHub requests are rate limited, you must pass a GitHub token saved in the environment variable `GITHUB_TOKEN` as a [Docker build secret][1] `--secret id=github-token,env=GITHUB_TOKEN`.

{{< tabs >}}
{{% tab "Linux/AMD64" %}}
{{< code-block lang="dockerfile" filename="Dockerfile" disable_copy="false" collapsible="true" >}}
RUN --mount=type=secret,id=github-token,env=GITHUB_TOKEN \
chmod +x /app/dotnet.sh && /app/dotnet.sh
{{< /code-block >}}
{{% /tab %}}

{{% tab "Alpine" %}}
{{< code-block lang="dockerfile" filename="Dockerfile" disable_copy="false" collapsible="true" >}}
# 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
{{< /code-block >}}
{{% /tab %}}
{{< /tabs >}}

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

2. **Install serverless-init**.

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

3. **Set up logs**.

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

Datadog also recommends 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, Datadog recommends writing your logs in JSON format. For example, you can use a third-party logging library such as `Serilog`:

{{< code-block lang="csharp" disable_copy="false" >}}
using Serilog;

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

logger.LogInformation("Hello World!");
{{< /code-block >}}

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

4. **Configure your application**.
Copy link
Contributor

Choose a reason for hiding this comment

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

should we include some a note in here or somewhere else about the service label thing in cloud run?

Copy link
Contributor

Choose a reason for hiding this comment

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

we can always improve further! but since this PR touches a lot of files and has a high potential of running into merge conflicts if we keep it open much longer, I'd like to merge this and tackle further changes in a new PR.


{{% gcr-configure-env-vars language="csharp" %}}

## 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,75 @@
---
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'
---

## Setup
1. **Install the Datadog Go tracer**.

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

{{< code-block lang="shell" disable_copy="false" >}}
go get github.com/DataDog/dd-trace-go/v2/ddtrace/tracer
{{< /code-block >}}

2. Add the following to your application code to initialize the tracer:
{{< code-block lang="go" disable_copy="false" >}}
tracer.Start()
defer tracer.Stop()
{{< /code-block >}}

You can also add additional packages:
{{< code-block lang="shell" disable_copy="false" >}}
# 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
{{< /code-block >}}

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. **Set up logs**.

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

Datadog also recommends 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, Datadog recommends 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 language="go" %}}

## 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,89 @@
---
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'
---

## Setup
1. **Install the Datadog Java tracer**.

1. Add the Datadog Java tracer to your Dockerfile:

{{< code-block lang="dockerfile" filename="Dockerfile" disable_copy="false" collapsible="true" >}}
ADD 'https://dtdg.co/latest-java-tracer' agent.jar
ENV JAVA_TOOL_OPTIONS="-javaagent:agent.jar"
{{< /code-block >}}

2. Add the tracer artifacts.
{{< tabs >}}
{{% tab "Maven" %}}
{{< code-block lang="xml" disable_copy="false" >}}
<dependency>
<groupId>com.datadoghq</groupId>
<artifactId>dd-trace-api</artifactId>
<version>DD_TRACE_JAVA_VERSION_HERE</version>
</dependency>
{{< /code-block >}}
{{% /tab %}}

{{% tab "Gradle" %}}
{{< code-block lang="groovy" disable_copy="false" >}}
implementation 'com.datadoghq:dd-trace-api:DD_TRACE_JAVA_VERSION_HERE'
{{< /code-block >}}
{{% /tab %}}
{{< /tabs >}}

3. 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. **Set up logs**.

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

Datadog also recommends 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, Datadog recommends writing your logs in *compact* JSON format. For example, you can use a third-party logging library such as `Log4j 2`:

{{< code-block lang="java" disable_copy="false" >}}
private static final Logger logger = LogManager.getLogger(App.class);
logger.info("Hello World!");
{{< /code-block >}}

{{< code-block lang="xml" filename="resources/log4j2.xml" disable_copy="false" >}}
<Configuration>
<Appenders>
<Console name="Console"><JsonLayout compact="true" eventEol="true" properties="true"/></Console>
</Appenders>
<Loggers><Root level="info"><AppenderRef ref="Console"/></Root></Loggers>
</Configuration>
{{< /code-block >}}

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

4. **Configure your application**.

{{% gcr-configure-env-vars language="java" %}}

## 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,82 @@
---
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'
---

## Setup
1. **Install the Datadog Node.js tracer**.

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

{{< code-block lang="shell" disable_copy="false" >}}
npm install dd-trace --save
{{< /code-block >}}

2. Add the following to your application code to initialize the tracer:
{{< code-block lang="javascript" disable_copy="false" >}}
const tracer = require('dd-trace').init({
logInjection: true,
});
{{< /code-block >}}

3. Set the following environment variable to specify that the `dd-trace/init` module is required when the Node.js process starts:
{{< code-block lang="dockerfile" disable_copy="false" >}}
ENV NODE_OPTIONS="--require dd-trace/init"
{{< /code-block >}}

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. **Set up logs**.

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

Datadog also recommends 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, Datadog recommends writing your logs in JSON format. For example, you can use a third-party logging library such as `winston`:
{{< code-block lang="javascript" disable_copy="false" >}}
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!`);
{{< /code-block >}}

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

4. **Configure your application**.

{{% gcr-configure-env-vars language="nodejs" %}}

## 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