forked from digma-ai/forkof-spring-petclinic
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle
More file actions
95 lines (78 loc) · 3.48 KB
/
Copy pathbuild.gradle
File metadata and controls
95 lines (78 loc) · 3.48 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
93
94
95
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.4'
id 'io.spring.dependency-management' version '1.1.0'
id 'org.graalvm.buildtools.native' version '0.9.20'
id 'de.undercouch.download' version '4.1.1'
}
apply plugin: 'java'
group = 'org.springframework.samples'
version = '3.0.0'
sourceCompatibility = '17'
def OPENTELEMETRY_VERSION = '1.26.0'
repositories {
mavenLocal()
mavenCentral()
maven {
url = uri("https://s01.oss.sonatype.org/content/groups/public/")
}
}
ext.webjarsFontawesomeVersion = "4.7.0"
ext.webjarsBootstrapVersion = "5.2.3"
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'javax.cache:cache-api'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api'
runtimeOnly 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly "org.webjars.npm:bootstrap:${webjarsBootstrapVersion}"
runtimeOnly "org.webjars.npm:font-awesome:${webjarsFontawesomeVersion}"
runtimeOnly 'com.github.ben-manes.caffeine:caffeine'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'org.postgresql:postgresql'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
//Enables instrumentation using @WithSpan
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-annotations:${OPENTELEMETRY_VERSION}")
implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:${OPENTELEMETRY_VERSION}")
// used for ClientTester
implementation("com.squareup.okhttp3:okhttp:4.9.3")
}
tasks.named('test') {
useJUnitPlatform()
}
// running with agent, will instrument HTTP client calls with library named io.opentelemetry.okhttp-3.0
task runClientTester(type: JavaExec) {
group = "Execution"
description = "Run Client Tester"
classpath = sourceSets.main.runtimeClasspath
mainClass = 'petclinic.client.ClientTester'
jvmArgs("-javaagent:build/otel/opentelemetry-javaagent.jar")
systemProperty("otel.service.name", "ClientTesterOfPetClinic")
systemProperty("otel.traces.exporter", "otlp")
environment("OTEL_RESOURCE_ATTRIBUTES", "digma.environment=TEST")
systemProperty("otel.exporter.otlp.traces.endpoint", "http://localhost:5050")
environment("PETSHOP_URL", "http://localhost:9753")
}
bootJar {
dependsOn("downloadOtelAgent")
dependsOn("downloadDigmaAgentExtension")
}
// Download the OpenTelemetry java agent and put it in the build directory
task downloadOtelAgent(type: Download) {
// otel agent version is 1.22.1
src "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar"
dest project.buildDir.toString() + "/otel/opentelemetry-javaagent.jar"
overwrite true
}
// Download the Digma OpenTelemetry agent extension and put it in the build directory
task downloadDigmaAgentExtension(type: Download) {
// digma extension version is 0.6.12
src "https://github.com/digma-ai/otel-java-instrumentation/releases/latest/download/digma-otel-agent-extension.jar"
dest project.buildDir.toString() + "/otel/digma-otel-agent-extension.jar"
overwrite true
}