forked from DataDog/dd-continuous-profiler-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
92 lines (82 loc) · 2.85 KB
/
Copy pathbuild.gradle
File metadata and controls
92 lines (82 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
plugins {
id 'java'
id 'application'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.sparkjava:spark-core:2.9.4'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.mongodb:mongodb-driver-sync:4.3.2'
implementation 'com.google.guava:guava:31.0.1-jre'
implementation 'org.slf4j:slf4j-api:2.0.0'
runtimeOnly 'ch.qos.logback:logback-classic:1.4.0'
}
processResources {
from('movies-v2.json.gz')
}
// Shared JVM arguments for all tasks
def sharedJvmArgs = [
"-Xmx1g",
"-XX:+ExitOnOutOfMemoryError",
"-javaagent:dd-java-agent.jar",
"-Ddd.profiling.enabled=true",
"-Ddd.profiling.heap.histogram.enabled=true",
"-XX:FlightRecorderOptions=stackdepth=256",
"-Ddd.logs.injection=true",
"-Ddd.trace.sample.rate=1",
"-Ddd.env=prod",
"-Ddd.version=${LocalDateTime.now().withNano(0)}",
]
// Task for running the main movies-api-java server
task runIntroServer(type: JavaExec) {
group = 'application'
description = 'Runs the intro-movies-api-java server (first part of profiling lab)'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'movies.IntroServer'
jvmArgs = sharedJvmArgs + [
"-Ddd.service=intro-movies-api-java",
"-Ddd.profiling.upload.period=10", // upload every 10s to see data faster
]
}
// Task for running the main movies-api-java server
task runServer(type: JavaExec) {
group = 'application'
description = 'Runs the movies-api-java server (main api service profiling demos)'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'movies.Server'
jvmArgs = sharedJvmArgs + [
"-Ddd.service=movies-api-java",
"-Ddd.profiling.upload.period=10", // upload every 10s to see data faster
]
}
// Task for running the timeline movies-api-java server
task runTimelineServer(type: JavaExec) {
group = 'application'
description = 'Runs the timeline movies-api-java server'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'movies.TimelineServer'
jvmArgs = sharedJvmArgs + [
"-Ddd.service=movies-api-java-timeline",
"-Ddd.profiling.upload.period=10", // upload every 10s to see data faster
]
}
// Task for running the leaky server
task runLeakyServer(type: JavaExec) {
group = 'application'
description = 'Runs the LeakyServer (memory-leaking service for profiling demos)'
classpath = sourceSets.main.runtimeClasspath
mainClass = 'movies.LeakyServer'
jvmArgs = sharedJvmArgs + [
"-Ddd.service=leaky-api-java",
"-Ddd.profiling.ddprof.liveheap.enabled=true",
"-Ddd.profiling.upload.period=60", // we saw heap metric mess up with shorter period
]
}
java {
toolchain {
// not running correctly on instruqt (I think jdk 17 is running)
languageVersion = JavaLanguageVersion.of(17)
}
}