Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions java/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gradle/
**/__pycache__/**
25 changes: 25 additions & 0 deletions java/spring-app-locust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Usage

### Run the app

Download the latest version of the agent:

wget -O dd-java-agent.jar 'https://search.maven.org/classic/remote_content?g=com.datadoghq&a=dd-java-agent&v=LATEST'

Build the app:

./gradlew :spring-app:build

Run the app with the agent enabled:

java -Ddd.service.name=trace-examples-spring -javaagent:dd-java-agent.jar -jar spring-app/build/libs/trace-examples-0.1.0.jar

### Load test with locust

Locust is based on python.

pip install -r requirements.txt

Run a load tests

locust -f locust-files/HomeControllerProfiling.py --no-web -c 100 -r 5
9 changes: 9 additions & 0 deletions java/spring-app-locust/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
group 'com.datadoghq.example'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
}

dependencies {
}
Binary file added java/spring-app-locust/dd-java-agent.jar
Binary file not shown.
34 changes: 34 additions & 0 deletions java/spring-app-locust/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.7'

services:

agent:
image: datadog/agent:latest
ports:
- 8125:8125
- 8126:8126
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc/:/host/proc/:ro
- /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
environment:
- DD_API_KEY=${DATADOG_API_KEY}
- DD_APM_ENABLED=true
- DD_APM_ENV=trace_examples_java

java:
image: java:8-jdk
volumes:
- ./:/var/trace-examples
- gradle-cache:/root/.gradle
working_dir: /var/trace-examples
depends_on:
- agent
ports:
- 8080:8080
environment:
DD_AGENT_HOST: agent
command: "./gradlew :spring-app:bootRun"

volumes:
gradle-cache:
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon Apr 01 14:43:29 EDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip
172 changes: 172 additions & 0 deletions java/spring-app-locust/gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions java/spring-app-locust/gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions java/spring-app-locust/locust-files/HomeControllerProfiling.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from locust import HttpLocust, TaskSet, task

class HomePageBehavior(TaskSet):

@task(1)
def index(self):
self.client.get("/")

class WebsiteHomePage(HttpLocust):
task_set = HomePageBehavior
min_wait = 100
max_wait = 100
host = 'http://localhost:8080'
Binary file not shown.
17 changes: 17 additions & 0 deletions java/spring-app-locust/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
certifi==2019.3.9
chardet==3.0.4
Click==7.0
Flask==1.0.2
gevent==1.4.0
greenlet==0.4.15
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10
locustio==0.11.0
MarkupSafe==1.1.1
msgpack==0.6.1
pyzmq==18.0.1
requests==2.21.0
six==1.12.0
urllib3==1.24.1
Werkzeug==0.15.1
3 changes: 3 additions & 0 deletions java/spring-app-locust/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rootProject.name = 'trace-examples'

include ':spring-app'
1 change: 1 addition & 0 deletions java/spring-app-locust/spring-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
Loading