Skip to content

Commit

Permalink
Merge pull request #17114 from brnhensley/patch-10
Browse files Browse the repository at this point in the history
chore: add lang identifiers
  • Loading branch information
homelessbirds committed Apr 29, 2024
2 parents ed0f988 + f678482 commit d78cdc0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ For applications deployed with the AWS Elastic Beanstalk Tomcat Platform:
2. Repackage and deploy your new WAR file as a new application or an update to a previous application.
3. Locate and connect to the underlaying EC2 instance. Once connected, find the path to `newrelic.jar` file using this command - ensure you search one directory at a time. Use either `/var` or `/usr` as appropriate.

```
sudo find </var | /usr> -name "newrelic.jar"
```sh
sudo find /var -name "newrelic.jar"
sudo find /usr -name "newrelic.jar"
```

To pass the `-javaagent` flag to the JVM:
Expand All @@ -47,7 +48,7 @@ For applications deployed with the AWS Elastic Beanstalk Tomcat Platform:
8. Scroll to <DoNotTranslate>**Updates, monitoring, and logging**</DoNotTranslate> and select <DoNotTranslate>**Edit**</DoNotTranslate> in the upper right corner.
9. Scroll to <DoNotTranslate>**Platform Software**</DoNotTranslate> and add the following line to the <DoNotTranslate>**JVM Options**</DoNotTranslate> field:

```
```sh
-javaagent:/full/path/to/newrelic.jar
```
7. Select <DoNotTranslate>**Apply**</DoNotTranslate> to save.
Expand All @@ -64,7 +65,7 @@ For applications deployed with the AWS Elastic Beanstalk Java SE Platform:

Pass the `-javaagent` flag as a JVM argument in the `Procfile`:

```
```makefile
web:java -javaagent:path/from/bundle/root/to/newrelic.jar -jar <your-application>.jar
```
3. Repackage and deploy the source bundle to your Elastic Beanstalk.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Download `newrelic-java.zip` using `curl`, `Invoke-WebRequest` (PowerShell), or
2. Change to a temporary directory where you can download the zip file.
3. Execute this `curl` command:

```
```sh
curl -O https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip
```
4. Unzip `newrelic-java.zip`
Expand All @@ -50,12 +50,12 @@ Download `newrelic-java.zip` using `curl`, `Invoke-WebRequest` (PowerShell), or
2. Change to a temporary directory where you can download the zip file.
3. Execute this PowerShell command:

```
```powershell
Invoke-WebRequest -Uri https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip -OutFile newrelic-java.zip
```
4. Unzip `newrelic-java.zip`:

```
```powershell
Expand-Archive -Path newrelic-java.zip -DestinationPath DESTINATION_PATH
```
</Collapser>
Expand All @@ -79,7 +79,7 @@ The startup script that contains the command to start your application server mu

For example, with Tomcat, use commands like these in the `Dockerfile`:

```
```dockerfile
RUN mkdir -p /usr/local/tomcat/newrelic
ADD ./newrelic/newrelic.jar /usr/local/tomcat/newrelic/newrelic.jar
ENV JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/tomcat/newrelic/newrelic.jar"
Expand All @@ -91,7 +91,7 @@ By default, agent behavior is controlled by configuration entries in `newrelic.y

Before we look at some specific configurations, here’s how to load `newrelic.yml` using the `Dockerfile`:

```
```dockerfile
ADD ./newrelic/newrelic.yml /usr/local/tomcat/newrelic/newrelic.yml
```

Expand All @@ -111,7 +111,7 @@ The application name is a configuration you set to identify your application in
You can reuse an application name for multiple apps serving the same role so that all the data from those apps rolls up into the same logical application in New Relic. For more detail about additional grouping options, see [Use multiple names for an app](/docs/agents/manage-apm-agents/app-naming/use-multiple-names-app).
</Callout>

Replace MY_APP_NAME with your application name in one of these `Dockerfile` commands:
Replace `MY_APP_NAME` with your application name in one of these `Dockerfile` commands:

<table>
<thead>
Expand All @@ -129,25 +129,23 @@ Replace MY_APP_NAME with your application name in one of these `Dockerfile` comm
<tbody>
<tr>
<td>
Environment
variable
Environment variable
</td>

<td>
```
```powershell
ENV NEW_RELIC_APP_NAME="MY_APP_NAME"
```
</td>
</tr>

<tr>
<td>
Java system
property
Java system property
</td>

<td>
```
```powershell
ENV JAVA_OPTS="$JAVA_OPTS -Dnewrelic.config.app_name='MY_APP_NAME'"
```
</td>
Expand All @@ -164,7 +162,7 @@ This configuration is required for you to report data to your New Relic account.
To copy your license key:

1. Go to the API keys UI and get a <InlinePopover type="licenseKey" />.
2. In one of these `Dockerfile` commands, replace MY_LICENSE_KEY with your license key:
2. In one of these `Dockerfile` commands, replace `MY_LICENSE_KEY` with your license key:

<table>
<thead>
Expand All @@ -182,25 +180,23 @@ To copy your license key:
<tbody>
<tr>
<td>
Environment
variable
Environment variable
</td>

<td>
```
```dockerfile
ENV NEW_RELIC_LICENSE_KEY="MY_LICENSE_KEY"
```
</td>
</tr>

<tr>
<td>
Java system
property
Java system property
</td>

<td>
```
```dockerfile
ENV JAVA_OPTS="$JAVA_OPTS -Dnewrelic.config.license_key='MY_LICENSE_KEY'"
```
</td>
Expand All @@ -217,7 +213,7 @@ By default, logs are written into the logs directory relative to the location of

Here’s a Dockerfile example where `tomcat` is the user who starts Tomcat:

```
```dockerfile
RUN mkdir -p /usr/local/tomcat/newrelic/logs
RUN chown -R tomcat:tomcat /usr/local/tomcat/newrelic/logs
```
Expand All @@ -240,25 +236,23 @@ You can also send the logs to `STDOUT` by adding one of the following to the Doc
<tbody>
<tr>
<td>
Environment
Variable
Environment Variable
</td>

<td>
```
```dockerfile
ENV NEW_RELIC_LOG_FILE_NAME=STDOUT
```
</td>
</tr>

<tr>
<td>
Java system
property
Java system property
</td>

<td>
```
```dockerfile
ENV JAVA_OPTS=-Dnewrelic.config.log_file_name=STDOUT
```
</td>
Expand All @@ -274,12 +268,12 @@ Here’s a `Dockerfile` example of passing the `newrelic.environment` Java syste

1. Using the shell form of the CMD instruction, include a reference to a new environment variable you choose (for example, `ENV`):

```
```dockerfile
CMD java -Dnewrelic.environment=$ENV -jar myjar.jar
```
2. In your `docker run` command line, include an argument to set the environment variable in the container:

```
```sh
docker run -it -e "ENV=dev" myDockerImage
```

Expand All @@ -305,7 +299,7 @@ Then, you can run specific agents by specifying the environment at runtime.
id="both-env-and-props"
title="Tomcat with environment and Java system properties"
>
```
```dockerfile
FROM tomcat:9
# Add the newrelic.jar and -javaagent parameters
RUN mkdir -p /usr/local/tomcat/newrelic
Expand All @@ -328,7 +322,7 @@ Then, you can run specific agents by specifying the environment at runtime.
id="start-up"
title="How to start an application with the Java agent"
>
```
```dockerfile
FROM openjdk:8
ADD my-application.jar /app
ADD newrelic.jar /app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ This example describes how to add New Relic to your GAE flex app by installing t
1. Add the Java agent dependencies to the project's `target` directory when the project is built, when you [download and unzip all Java agent components](/docs/agents/java-agent/frameworks/maven-installation-java#h2-zip).
2. After adding the Java agent dependencies to the `pom.xml`, build your application by running:

```
```sh
mvn clean install
```
3. Check your project's `target` directory to find the app's `WAR` file and an unzipped `newrelic` directory.
Expand All @@ -77,9 +77,9 @@ This example describes how to add New Relic to your GAE flex app by installing t
id="configure-app-yaml"
title="3. Configure your app.yaml"
>
The [app.yaml](https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml) configuration file is required for a GAE flexible environment app with a custom runtime. At a minimum, make sure it contains:
The [`app.yaml`](https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml) configuration file is required for a GAE flexible environment app with a custom runtime. At a minimum, make sure it contains:

```
```yml
env: flex
runtime: custom
```
Expand All @@ -91,7 +91,7 @@ This example describes how to add New Relic to your GAE flex app by installing t
>
The [Dockerfile](http://docs.docker.com/engine/reference/builder/) defines the Docker image to be built and is required for a GAE flexible environment app. In the following Dockerfile example code, the `newrelic.yml` and `catalina.sh` files have been configured locally, to replace those already copied to the Docker image. (You can add your [New Relic license key](/docs/apis/intro-apis/new-relic-api-keys/#ingest-license-key) directly to your Dockerfile, or use an environment variable in your `docker run` command.)

```
```dockerfile
# base Tomcat image to build Docker image from
FROM tomcat:8.5.14-jre8

Expand All @@ -109,7 +109,7 @@ This example describes how to add New Relic to your GAE flex app by installing t
# update Java agent yml with license_key and app_name and copy to image
ADD newrelic.yml ${NEWRELIC_HOME}

# update catalina.sh with <a href="/docs/agents/java-agent/installation/include-java-agent-jvm-argument#tomcat-catalinash">-javaagent:/path/to/newrelic.jar</a> and copy to image
# update catalina.sh with -javaagent:/path/to/newrelic.jar and copy to image
ADD catalina.sh /usr/local/tomcat/bin/
```
</Collapser>
Expand All @@ -120,7 +120,7 @@ This example describes how to add New Relic to your GAE flex app by installing t
>
To build a Docker image that runs Tomcat with the New Relic Java agent monitoring your deployed application WAR, run the following command. Be sure to include the period at the end of the code, to indicate the current directory contains the build files.

```
```sh
docker build -f Dockerfile -t newrelic-tomcat .
```

Expand All @@ -133,13 +133,13 @@ This example describes how to add New Relic to your GAE flex app by installing t
>
1. To deploy your Docker image to your [initialized GAE flexible environment](https://cloud.google.com/sdk/docs/initializing), run the following command:

```
```sh
gcloud app deploy
```
2. Wait until the deployment completes.
3. To open the app in the browser, run the following command:

```
```sh
gcloud app browse
```
4. To view your GAE flex app data in New Relic, go to the [APM <DoNotTranslate>**Summary**</DoNotTranslate> page](/docs/apm/applications-menu/monitoring/apm-overview-page).
Expand All @@ -154,7 +154,7 @@ If you create a custom runtime, your app must be able to handle a large number o

<DoNotTranslate>**Recommendation:**</DoNotTranslate> Configure your `app.yaml` to [disable health checks](https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml#health_checks) by adding:

```
```yml
health_check:
enable_health_check: False
```
Expand All @@ -166,7 +166,7 @@ Use these resources to troubleshoot your GAE flex environment app:
* To connect to the GAE instance and start a shell in the Docker container running your code, see [Debugging an Instance](https://cloud.google.com/appengine/docs/flexible/java/debugging-an-instance).
* To redirect New Relic Java agent logs to [Stackdriver](http://cloud.google.com/logging/docs/view/logs_viewer_v2) in the [Cloud Platform Console](https://cloud.google.com/compute/docs/console), change the `newrelic.yml`file to:

```
```yml
log_file_name: STDOUT
```
* To view the logs, use the [Cloud Platform Console's Log Viewer](https://cloud.google.com/appengine/docs/flexible/php/writing-application-logs).

0 comments on commit d78cdc0

Please sign in to comment.