-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update Cloud Run and Functions to include profiler #27780
base: master
Are you sure you want to change the base?
Update Cloud Run and Functions to include profiler #27780
Conversation
Preview links (active after the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some feedback. Let me know if anything's unclear!
@@ -140,6 +156,9 @@ ENV DD_TRACE_DEBUG=true | |||
|
|||
ENTRYPOINT ["dotnet", "dotnet.dll"] | |||
``` | |||
#### Profiling | |||
The profiler is shipped within Datadog tracing libraries. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler. See [Enabling the .NET Profiler][5] to add the environment variables. | |||
The Dockerfile above also has the environment variables for the profiler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Dockerfile above also has the environment variables for the profiler. | |
The previous Dockerfile example also has the environment variables for the profiler. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Best to avoid directional terms (https://datadoghq.atlassian.net/wiki/spaces/docs4docs/pages/2752086538/Words+and+Phrases+to+Avoid#%E2%80%9Cbelow%E2%80%9D-and-directional-terms) !
2. Run `mvn clean package` to update the `target` directory with the new `.jar` used in your Dockerfile. | ||
|
||
<div class="alert alert-info"> | ||
As an alternative to the provided Dockerfile, you can also use Artifact Registry to store the images built from your function source code. You can use <a href="#">Google Cloud Build</a> or <a href="#">Buildpacks</a> to build and deploy your image.<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an alternative to the provided Dockerfile, you can also use Artifact Registry to store the images built from your function source code. You can use <a href="#">Google Cloud Build</a> or <a href="#">Buildpacks</a> to build and deploy your image.<br/> | |
As an alternative to the provided Dockerfile, you can use Artifact Registry to store the images built from your function source code. You can use <a href="#">Google Cloud Build</a> or <a href="#">Buildpacks</a> to build and deploy your image.<br/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if the hrefs are functioning as expected? They just bring me to the top of this page.
Cloud Run Function code runs with a classpath that includes the function code itself and its dependencies. | ||
The Maven plugin automatically computes the classpath based on the dependencies expressed in pom.xml. | ||
When [invoking the Functions Framework directly](https://github.com/GoogleCloudPlatform/functions-framework-java?tab=readme-ov-file#function-classpath)with the datadog agent, you must update your dockerfile ENTRYPOINT to use `--classpath` and `--target` to indicate how to find the code and add the java option fo the datadog agent `-javaagent:dd-java-agent.jar`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cloud Run Function code runs with a classpath that includes the function code itself and its dependencies. | |
The Maven plugin automatically computes the classpath based on the dependencies expressed in pom.xml. | |
When [invoking the Functions Framework directly](https://github.com/GoogleCloudPlatform/functions-framework-java?tab=readme-ov-file#function-classpath)with the datadog agent, you must update your dockerfile ENTRYPOINT to use `--classpath` and `--target` to indicate how to find the code and add the java option fo the datadog agent `-javaagent:dd-java-agent.jar`. | |
Cloud Run Function code runs with a classpath that includes the function code and its dependencies. The Maven plugin automatically determines the classpath based on the dependencies in `pom.xml`. | |
If invoking the Functions Framework directly with the Datadog Agent, update your Dockerfile `ENTRYPOINT` to include the `--classpath` and `--target` options, along with the Java agent flag: |
- Replace `FUNCTION_JAR` with the target jar generated from the mvn step above with all dependencies. | ||
- Replace `FUNCTION_TARGET` with Function entry point. For example, `gcfv2.HelloworldApplication`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Replace `FUNCTION_JAR` with the target jar generated from the mvn step above with all dependencies. | |
- Replace `FUNCTION_TARGET` with Function entry point. For example, `gcfv2.HelloworldApplication`. | |
- Replace `FUNCTION_JAR` with the target JAR generated from the Maven build, including all dependencies. | |
- Replace `FUNCTION_TARGET` with the function's entry point (for example, `gcfv2.HelloworldApplication`). |
``` | ||
2. Add `dd-java-agent.jar` to your Dockerfile. | ||
- Replace `FUNCTION_JAR` with the target jar generated from the mvn step above with all dependencies. | ||
- Replace `FUNCTION_TARGET` with Function entry point. For example, `gcfv2.HelloworldApplication`. | ||
|
||
**Example `Dockerfile`**: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this (all the "Example Dockerfile" content) may need to be indented if it's supposed to all fall under step 3??
|
||
``` | ||
|
||
4. Deploy the Java function by running the following command in the top level directory that contains your `pom.xml` and `Dockerfile`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4. Deploy the Java function by running the following command in the top level directory that contains your `pom.xml` and `Dockerfile`: | |
4. To deploy the Java function, run the following command from the top-level directory containing your `pom.xml` and `Dockerfile`: |
@@ -171,7 +234,10 @@ To set up logging in your application, see [Python Log Collection][3]. [Python L | |||
- Replace `FUNCTION_NAME` with the name of your Cloud Run function. | |||
- Ensure that you set [--clear-base-image][5] to deploy your Cloud Function with the Dockerfile. | |||
|
|||
4. When you set up your [containers](#containers), ensure that you use the same container image as what you deployed in the previous steps. | |||
5. When you set up your [containers](#containers), ensure that you use the same container image as what you deployed in the previous steps. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5. When you set up your [containers](#containers), ensure that you use the same container image as what you deployed in the previous steps. | |
5. When setting up your [containers](#containers), use the same container image deployed in the previous steps. |
@@ -507,17 +612,33 @@ public class HelloworldApplication implements HttpFunction { | |||
#### Dockerfile | |||
|
|||
```dockerfile | |||
# Download datadog java agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Download datadog java agent | |
# Download Datadog Java Agent |
|
||
**Example `Dockerfile`**: | ||
```dockerfile | ||
FROM openjdk:17-jdk | ||
# Download datadog java agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Download datadog java agent | |
# Download Datadog Java Agent |
@@ -26,6 +26,9 @@ In your main application, add the `dd-trace-js` library. See [Tracing Node.js ap | |||
|
|||
Set `ENV NODE_OPTIONS="--require dd-trace/init"`. This specifies that the `dd-trace/init` module is required when the Node.js process starts. | |||
|
|||
#### Profiling | |||
The profiler is shipped within Datadog tracing libraries. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler. See [Enabling the Node.js Profiler][5] to add the environment variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The profiler is shipped within Datadog tracing libraries. If you are already using APM to collect traces for your application, you can skip installing the library and go directly to enabling the profiler. See [Enabling the Node.js Profiler][5] to add the environment variables. | |
The profiler is shipped within Datadog tracing libraries. If you are already using APM to collect traces for your application, you can skip installing the library and proceed to enabling the profiler. See [Enabling the Node.js Profiler][5] to add the environment variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"proceed to" is a bit clearer and more professional than "go directly to". Not a huge deal, but I'd recommend updating all the text to follow suit!
What does this PR do? What is the motivation?
Updates Dockerfile for Java cloud run functions and add profiler section to both Cloud Run and Cloud run Functions
Merge instructions
Merge readiness:
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:Additional notes