Skip to content

Commit

Permalink
Merge pull request #6 from musabbozkurt/add-new-relic-java-agent
Browse files Browse the repository at this point in the history
Add New Relic Java agent
  • Loading branch information
musabbozkurt authored Aug 2, 2024
2 parents 9feb6d4 + 8483bb3 commit f0480f1
Show file tree
Hide file tree
Showing 8 changed files with 586 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NEW_RELIC_LICENSE_KEY=eu01xxhu5ic8N0TmUkXQLgb0VWufpuyvapd0Qz63
NEW_RELIC_APP_NAME=inventory-management-service
NEW_RELIC_ENDPOINT=https://otlp.eu01.nr-data.net
NEW_RELIC_ENABLED=false
NEW_RELIC_INFRA_AGENT_REPLICAS=0
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@ build/

### VS Code ###
.vscode/

### Ignore everything under /opt/newrelic/ ###
opt/newrelic/*

### Do not ignore the following files and directories ###
!opt/newrelic/newrelic.yml
!opt/newrelic/scripts/
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
FROM openjdk:21-jdk-slim

# Uncomment the following command to define the location of the New Relic agent JAR
# ARG NEW_RELIC_AGENT_JAR=opt/newrelic/newrelic.jar

# Define the location of the application JAR
ARG JAR_FILE=target/*.jar

# Uncomment the following command to copy the New Relic agent JAR into the Docker image
# COPY ${NEW_RELIC_AGENT_JAR} /opt/newrelic/newrelic.jar

# Copy the application JAR into the Docker image
COPY ${JAR_FILE} inventory-management-service.jar

# Set the entrypoint to run the application
ENTRYPOINT ["java","-jar","/inventory-management-service.jar"]

# Use the following ENTRYPOINT command instead of the above ENTRYPOINT command
# to set the entrypoint to run the application with the New Relic Java agent
# ENTRYPOINT ["java", "-javaagent:/opt/newrelic/newrelic.jar", "-jar", "/inventory-management-service.jar"]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

1. Run `mvn clean install` or `mvn clean package`
2. Run `mvn spring-boot:run` or `./mvnw spring-boot:run`
- Run [./scripts/run.sh](scripts%2Frun.sh) to start the application with `New Relic Java agent` (OPTIONAL)

-----

Expand Down
Loading

0 comments on commit f0480f1

Please sign in to comment.