Skip to content
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

DOCS-9496 - adding gcr guides #26347

Merged
merged 12 commits into from
Jan 10, 2025
Merged

DOCS-9496 - adding gcr guides #26347

merged 12 commits into from
Jan 10, 2025

Conversation

cswatt
Copy link
Contributor

@cswatt cswatt commented Nov 18, 2024

What does this PR do? What is the motivation?

Merge instructions

Merge queue is enabled in this repo. To have it automatically merged after it receives the required reviews, create the PR (from a branch that follows the <yourname>/description naming convention) and then add the following PR comment:

/merge

Additional notes

@cswatt cswatt added the WORK IN PROGRESS No review needed, it's a wip ;) label Nov 18, 2024
@cswatt cswatt requested review from a team as code owners November 18, 2024 20:48
@github-actions github-actions bot added Images Images are added/removed with this PR Guide Content impacting a guide labels Nov 18, 2024
Copy link
Contributor

Preview links (active after the build_preview check completes)

New or renamed files

Modified Files

Copy link
Contributor

@brandondatadog brandondatadog left a comment

Choose a reason for hiding this comment

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

LGTM

@nina9753
Copy link
Contributor

nina9753 commented Nov 25, 2024

Also if possible can we add in a section for a yaml deploy using this code example gcloud run services replace sidecar-example.yaml

@cswatt cswatt force-pushed the cswatt/gcr_sidecar branch from 993a152 to d9ad6e5 Compare December 11, 2024 22:20
Copy link
Contributor

@nina9753 nina9753 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates!

@cswatt cswatt removed the WORK IN PROGRESS No review needed, it's a wip ;) label Jan 6, 2025
@cswatt
Copy link
Contributor Author

cswatt commented Jan 6, 2025

added DOCS-9819 to review

@cswatt cswatt added the editorial review Waiting on a more in-depth review label Jan 6, 2025
@cswatt cswatt requested a review from a team as a code owner January 6, 2025 22:29
content/en/serverless/google_cloud_run/_index.md Outdated Show resolved Hide resolved

To get full instrumentation, ensure you are calling `datadog-init` as the first command that runs inside your Docker container. You can do this through by setting it as the entrypoint, or by setting it as the first argument in CMD.
In your main application, add the `dd-trace-py` library. See [Tracing Python applications][1] for instructions. You can also use [Tutorial - Enabling tracing for a Python application and Datadog Agent in containers][5].
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalize the two doc titles as they're capitalized on the linked page?

content/en/serverless/google_cloud_run/_index.md Outdated Show resolved Hide resolved

{{% svl-init-java %}}
In your main application, add the `dd-trace-java` library. Follow the instructions in [Tracing Java applications][1] or use the following example Dockerfile to add and start the tracing library with automatic instrumentation:
Copy link
Contributor

Choose a reason for hiding this comment

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

I won't keep flagging these, but use title case for Tracing Java Applications, since it's a doc?

content/en/serverless/google_cloud_run/_index.md Outdated Show resolved Hide resolved
content/en/serverless/guide/gcr_serverless_init.md Outdated Show resolved Hide resolved
content/en/serverless/guide/gcr_serverless_init.md Outdated Show resolved Hide resolved
content/en/serverless/guide/gcr_serverless_init.md Outdated Show resolved Hide resolved
content/en/serverless/guide/gcr_serverless_init.md Outdated Show resolved Hide resolved
content/en/serverless/guide/gcr_serverless_init.md Outdated Show resolved Hide resolved
Comment on lines 112 to 113
- `DD_TRACE_ENABLED`: Set to `true` to enable tracing.
- `DD_TRACE_PROPAGATION_STYLE`: Set this to `datadog` to use context propagation and log trace correlation.
Copy link
Contributor

Choose a reason for hiding this comment

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

Both of these are set by default. I would remove them from the doc to simplify the setup.

Comment on lines 117 to 122
The following command deploys the service and allows any external connection to reach it. Set `DD_API_KEY` as an environment variable, and set your service listening to port 8080.

```
shell
gcloud run deploy <APP_NAME> --image=gcr.io/<YOUR_PROJECT>/<APP_NAME> \
--port=8080 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Customers may not be using this port. I believe it is dependent on their app and it would be better to clarify this as an example. @nina9753 can you confirm if this is correct and help clarify this a bit more since you have more context?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a link to Google Public doc here with all possible env vars. Can we also add a note that the exposed port inside of their docker file should match the port specified in the command. When deploying through the UI the port defaults to 8080 for the main container.

| `DD_SITE` | [Datadog site][5] - **Required** |
| `DD_LOGS_ENABLED` | When true, send logs (stdout and stderr) to Datadog. Defaults to false. |
| `DD_LOGS_INJECTION`| When true, enrich all logs with trace data for supported loggers in [Java][19], [Node][20], [.NET][21], and [PHP][22]. See additional docs for [Python][23], [Go][24], and [Ruby][25]. |
| `DD_TRACE_SAMPLE_RATE`| Controls the trace ingestion sample rate `0.0` and `1.0`. |
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should remove this env var as it is an optional setting. It should be 1 by default and this will probably lead to support cases.

Copy link
Contributor

@nina9753 nina9753 left a comment

Choose a reason for hiding this comment

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

sorry just a couple more comments

Comment on lines 117 to 122
The following command deploys the service and allows any external connection to reach it. Set `DD_API_KEY` as an environment variable, and set your service listening to port 8080.

```
shell
gcloud run deploy <APP_NAME> --image=gcr.io/<YOUR_PROJECT>/<APP_NAME> \
--port=8080 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add a link to Google Public doc here with all possible env vars. Can we also add a note that the exposed port inside of their docker file should match the port specified in the command. When deploying through the UI the port defaults to 8080 for the main container.


Images are tagged based on semantic versioning, with each new version receiving three relevant tags:
#### Logs
The Datadog sidecar collects logs through a shared volume. To forward logs from your main container to the sidecar, configure your application to write all logs to a location such as `shared-volume/logs/*.log`.
Copy link
Contributor

@nina9753 nina9753 Jan 8, 2025

Choose a reason for hiding this comment

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

Can we update this to point to Shared-volume creation in the section below but also say that its only necessary if they want logs? I notice we tell them here configure your application to write all logs to a location such as `shared-volume/logs/*.log but we do not tell them or point them to how to configure this setup. Can we add the section about setting the environment var DD_SERVERLESS_LOG_PATH=shared-volume/logs/*.log on both containers and to setup the in-memory volume mount

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we potentially update this to say :
The Datadog sidecar collects logs through a shared volume. To forward logs from your main container to the sidecar, configure your application to write all logs to a location such as shared-volume/logs/*.log using the steps below. You must follow the setups in the GCP UI to add the env var DD_SERVERLESS_LOG_PATH and a shared Volume Mount to both the main and sidecar container. If you decide to deploy using YAML or Terraform the environment variables, health check, and volume mount are already added.

{{% tab "YAML deploy" %}}
To deploy your Cloud Run service with a YAML service specification:

1. Create a YAML file that contains the following:
Copy link
Contributor

@nina9753 nina9753 Jan 8, 2025

Choose a reason for hiding this comment

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

Can we explain the shared-volume mount, Container start-up, order, and health check automatically? Can we do the same for Terraform

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What exactly should this say?

Copy link
Contributor

@nina9753 nina9753 Jan 9, 2025

Choose a reason for hiding this comment

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

I think this could say something like this under To deploy your Cloud Run service with a YAML service specification:
If you decide to deploy using YAML or Terraform, the environment variables, startup health check, and volume mount are already added. If you don't want to enable logs, you can remove the shared volume from the example below. Make sure the container port for the main container is the same as the one exposed in your Dockerfile/service.

An additional note for Terraform should also say
We also added an IAM policy google_cloud_run_service_iam_member to the terraform example. If you do not want to allow public access, please remove that section at the bottom of the example

@cswatt
Copy link
Contributor Author

cswatt commented Jan 10, 2025

/merge

@dd-devflow
Copy link

dd-devflow bot commented Jan 10, 2025

Devflow running: /merge

View all feedbacks in Devflow UI.


2025-01-10 19:40:52 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-01-10 19:55:16 UTC ℹ️ MergeQueue: merge request added to the queue

The median merge time in master is 7m.


2025-01-10 20:04:18 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue bot merged commit 0f1b1f8 into master Jan 10, 2025
18 of 20 checks passed
@dd-mergequeue dd-mergequeue bot deleted the cswatt/gcr_sidecar branch January 10, 2025 20:04
domalessi pushed a commit that referenced this pull request Jan 20, 2025
* adding gcr guides

* addressing feedback

* updates

* Apply suggestions from code review

Co-authored-by: Jen Gilbert <[email protected]>

* applying updates

* removing default line

* adding note about logs setup to all language sections

* add container image example

* more updates

* removing last envvar

* final changes

---------

Co-authored-by: Jen Gilbert <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial review Waiting on a more in-depth review Guide Content impacting a guide Images Images are added/removed with this PR mergequeue-status: done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants