Skip to content

Commit 552562f

Browse files
committed
Observability for Java-Swing-Tutor
1 parent 9aa0cf0 commit 552562f

11 files changed

Lines changed: 107 additions & 84 deletions

File tree

deployment/ingress/traefik-ingressroute.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
priority: 10
3232

3333
# Health check
34-
- match: Host(`api.java-swing.com`) && Path(`/actuator/health`)
34+
- match: Host(`api.java-swing.com`) && Path(`/health`)
3535
kind: Rule
3636
services:
3737
- name: java-swing-tutor-service

desktop-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.posadskiy</groupId>
99
<artifactId>java-swing-tutor</artifactId>
10-
<version>1.2.0</version>
10+
<version>1.2.4</version>
1111
</parent>
1212

1313
<artifactId>desktop-client</artifactId>

domain/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.posadskiy</groupId>
99
<artifactId>java-swing-tutor</artifactId>
10-
<version>1.2.0</version>
10+
<version>1.2.4</version>
1111
</parent>
1212

1313
<artifactId>domain</artifactId>

flyway/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.posadskiy</groupId>
99
<artifactId>java-swing-tutor</artifactId>
10-
<version>1.2.0</version>
10+
<version>1.2.4</version>
1111
</parent>
1212

1313
<artifactId>flyway</artifactId>

pom.xml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.posadskiy</groupId>
66
<artifactId>java-swing-tutor</artifactId>
7-
<version>1.2.0</version>
7+
<version>1.2.4</version>
88
<packaging>pom</packaging>
99
<name>java-swing-tutor</name>
1010

@@ -79,7 +79,35 @@
7979
<failsOnError>false</failsOnError>
8080
</configuration>
8181
</plugin>
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-shade-plugin</artifactId>
85+
<version>3.6.0</version>
86+
</plugin>
8287
</plugins>
8388
</pluginManagement>
89+
90+
<plugins>
91+
<plugin>
92+
<groupId>org.apache.maven.plugins</groupId>
93+
<artifactId>maven-shade-plugin</artifactId>
94+
<executions>
95+
<execution>
96+
<phase>package</phase>
97+
<goals>
98+
<goal>shade</goal>
99+
</goals>
100+
<configuration>
101+
<createDependencyReducedPom>false</createDependencyReducedPom>
102+
<transformers>
103+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
104+
<mainClass>${exec.mainClass}</mainClass>
105+
</transformer>
106+
</transformers>
107+
</configuration>
108+
</execution>
109+
</executions>
110+
</plugin>
111+
</plugins>
84112
</build>
85113
</project>

service/deployment/deployment.yaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ spec:
1414
metadata:
1515
labels:
1616
app: java-swing-tutor-service
17+
annotations:
18+
prometheus.io/scrape: "true"
19+
prometheus.io/path: "/prometheus"
20+
prometheus.io/port: "8400"
1721
spec:
1822
imagePullSecrets:
1923
- name: dockerhub-registry-secret
@@ -49,6 +53,22 @@ spec:
4953
value: "http://auth-service.microservices.svc.cluster.local:8100"
5054
- name: USER_SERVICE_BASE_URL
5155
value: "http://user-service.microservices.svc.cluster.local:8095"
56+
- name: OTEL_SERVICE_NAME
57+
value: "java-swing-tutor-service"
58+
- name: OTEL_EXPORTER_OTLP_ENDPOINT
59+
value: "http://grafana-alloy.observability.svc.cluster.local:4317"
60+
- name: OTEL_TRACES_SAMPLER
61+
value: parentbased_traceidratio
62+
- name: OTEL_TRACES_SAMPLER_ARG
63+
value: "1.0"
64+
- name: DB_MAX_POOL_SIZE
65+
value: "2"
66+
- name: DB_MIN_IDLE
67+
value: "0"
68+
- name: DB_IDLE_TIMEOUT
69+
value: "60000"
70+
- name: DB_MAX_LIFETIME
71+
value: "600000"
5272
resources:
5373
requests:
5474
memory: "512Mi"
@@ -58,15 +78,15 @@ spec:
5878
cpu: "500m"
5979
livenessProbe:
6080
httpGet:
61-
path: /actuator/health
81+
path: /health
6282
port: 8400
6383
initialDelaySeconds: 60
6484
periodSeconds: 10
6585
timeoutSeconds: 5
6686
failureThreshold: 3
6787
readinessProbe:
6888
httpGet:
69-
path: /actuator/health
89+
path: /health
7090
port: 8400
7191
initialDelaySeconds: 30
7292
periodSeconds: 5

service/deployment/network-policy.yaml

Lines changed: 0 additions & 57 deletions
This file was deleted.

service/deployment/scripts/deploy.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export IMAGE_VERSION="$DOCKERHUB_USERNAME/java-swing-tutor-service:$VERSION"
4444
echo "🚀 Applying backend manifest (version: $VERSION)..."
4545
envsubst < "$DEPLOYMENT_DIR/deployment.yaml" | kubectl apply -f -
4646
kubectl apply -f "$DEPLOYMENT_DIR/service.yaml"
47-
kubectl apply -f "$DEPLOYMENT_DIR/network-policy.yaml"
4847

4948
echo ""
5049
echo "⏳ Waiting for deployment..."

service/pom.xml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.posadskiy</groupId>
99
<artifactId>java-swing-tutor</artifactId>
10-
<version>1.2.0</version>
10+
<version>1.2.4</version>
1111
</parent>
1212

1313
<artifactId>service</artifactId>
@@ -74,6 +74,10 @@
7474
<groupId>io.micronaut</groupId>
7575
<artifactId>micronaut-management</artifactId>
7676
</dependency>
77+
<dependency>
78+
<groupId>io.micronaut.micrometer</groupId>
79+
<artifactId>micronaut-micrometer-core</artifactId>
80+
</dependency>
7781
<dependency>
7882
<groupId>io.micronaut.micrometer</groupId>
7983
<artifactId>micronaut-micrometer-registry-prometheus</artifactId>
@@ -188,37 +192,19 @@
188192
<plugin>
189193
<groupId>io.micronaut.maven</groupId>
190194
<artifactId>micronaut-maven-plugin</artifactId>
191-
<version>4.11.6</version>
192195
<configuration>
193196
<mainClass>${exec.mainClass}</mainClass>
194197
</configuration>
195198
</plugin>
196-
<plugin>
197-
<groupId>org.apache.maven.plugins</groupId>
198-
<artifactId>maven-shade-plugin</artifactId>
199-
<version>3.6.0</version>
200-
</plugin>
201199
<plugin>
202200
<groupId>org.apache.maven.plugins</groupId>
203201
<artifactId>maven-compiler-plugin</artifactId>
204202
<configuration>
205-
<compilerArgs>
206-
<arg>-parameters</arg>
207-
</compilerArgs>
208203
<annotationProcessorPaths combine.children="append">
209-
<path>
210-
<groupId>io.micronaut</groupId>
211-
<artifactId>micronaut-inject-java</artifactId>
212-
<version>${micronaut.version}</version>
213-
</path>
214204
<path>
215205
<groupId>io.micronaut.data</groupId>
216206
<artifactId>micronaut-data-processor</artifactId>
217207
</path>
218-
<path>
219-
<groupId>io.micronaut.validation</groupId>
220-
<artifactId>micronaut-validation-processor</artifactId>
221-
</path>
222208
</annotationProcessorPaths>
223209
</configuration>
224210
</plugin>

service/src/main/resources/application-prod.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ service:
99
# If user-service is in 'user' namespace: http://user-service.user.svc.cluster.local:8095
1010
# If user-service is in 'default' namespace: http://user-service.default.svc.cluster.local:8095
1111
user: ${USER_SERVICE_BASE_URL:http://user-service.default.svc.cluster.local:8095}
12+
13+
otel:
14+
traces:
15+
sampler:
16+
arg: ${OTEL_TRACES_SAMPLER_ARG:1.0}

0 commit comments

Comments
 (0)