Skip to content

Commit f447485

Browse files
committed
replaced opentelemetry java agent with spring boot actuator, loki logback appender, and spring tempo
1 parent 7338791 commit f447485

File tree

6 files changed

+50
-35
lines changed

6 files changed

+50
-35
lines changed

src/Services/Webhooks/webhooks-client/Dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ RUN mvn -f /src/Services/Webhooks/webhooks-client/pom.xml -s /src/settings.xml p
4444
FROM base AS final
4545
WORKDIR /app
4646
COPY --from=build /src/Services/Webhooks/webhooks-client/target/webhooks-client.jar ./webhooks-client.jar
47-
COPY --from=build /src/Services/Webhooks/webhooks-client/target/opentelemetry-javaagent.jar ./opentelemetry-javaagent.jar
4847

4948
# CMD tail -f /dev/null
5049

5150
## ADDED SLEEP FOR 60 SECONDS TO WAIT FOR DB SERVER TO BE UP. with out sh sleep is failing
5251
# ENTRYPOINT ["sh", "-c", "sleep 60 && java -jar webhooks-api.jar"]
5352
# ENTRYPOINT sleep 60 && java -jar webhooks-api.jar
5453
# Sleep not working . Giving error during startup
55-
ENTRYPOINT ["java", "-javaagent:./opentelemetry-javaagent.jar","-Dspring.profiles.active=dev", "-jar", "webhooks-client.jar"]
54+
ENTRYPOINT ["java", "-Dspring.profiles.active=dev", "-jar", "webhooks-client.jar"]
5655

5756

5857

src/Services/Webhooks/webhooks-client/pom.xml

+1-22
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,7 @@
2020
<dependency>
2121
<groupId>org.springframework.boot</groupId>
2222
<artifactId>spring-boot-starter-web</artifactId>
23-
</dependency>
24-
25-
<dependency>
26-
<groupId>org.springframework.boot</groupId>
27-
<artifactId>spring-boot-devtools</artifactId>
28-
<scope>runtime</scope>
29-
<optional>true</optional>
30-
</dependency>
31-
<dependency>
32-
<groupId>org.projectlombok</groupId>
33-
<artifactId>lombok</artifactId>
34-
<optional>true</optional>
35-
</dependency>
36-
<dependency>
37-
<groupId>io.opentelemetry.javaagent</groupId>
38-
<artifactId>opentelemetry-javaagent</artifactId>
39-
</dependency>
40-
<dependency>
41-
<groupId>org.springframework.boot</groupId>
42-
<artifactId>spring-boot-starter-test</artifactId>
43-
<scope>test</scope>
44-
</dependency>
23+
</dependency>
4524

4625
<dependency>
4726
<groupId>org.springframework.boot</groupId>

src/Services/Webhooks/webhooks-client/src/main/java/com/eshoponcontainers/webhooksclient/config/SecurityConfig.java

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
3636
c -> c.requestMatchers("/checkpost").permitAll()
3737
.requestMatchers("/check").permitAll()
3838
.requestMatchers("/webhook-received").permitAll()
39+
.requestMatchers("/actuator/**").permitAll()
3940
.requestMatchers("/").permitAll()
4041
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
4142
.anyRequest().authenticated())

src/Services/Webhooks/webhooks-client/src/main/resources/application.yml

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
1-
spring.profiles.active: dev
2-
spring.application.name: webhooks-client
1+
spring:
2+
application:
3+
name: webhooks-client
4+
profiles:
5+
active:
6+
- dev
7+
8+
#enable management endpoints
9+
management:
10+
metrics:
11+
distribution:
12+
percentiles-histogram:
13+
http:
14+
server:
15+
requests: true
16+
tracing:
17+
sampling:
18+
probability: 1.0
19+
20+
endpoints:
21+
web:
22+
exposure:
23+
include: "*"
24+
endpoint:
25+
health:
26+
show-details: always
27+
28+
prometheus:
29+
metrics:
30+
export:
31+
enabled: true
32+
33+
zipkin:
34+
tracing:
35+
endpoint: http://tempo:9411/api/v2/spans
336

437
oauthIssuerUrl: http://host.docker.internal:8095/realms/eshoponcontainers
538

src/docker-compose.override.yml

+3
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,8 @@ services:
2323
webhooks-api:
2424
environment:
2525
SERVER_SERVLET_CONTEXT_PATH: "/webhooks-api"
26+
webhooks-client:
27+
environment:
28+
SERVER_SERVLET_CONTEXT_PATH: "/webhooks-client"
2629

2730

src/docker-compose.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -225,15 +225,15 @@ services:
225225
image: ${REGISTRY:-springeshop}/webhooksclient:latest
226226
env_file:
227227
- .env
228-
environment:
229-
OTEL_TRACES_EXPORTER: "jaeger"
230-
OTEL_SERVICE_NAME: "webhooks-api"
231-
OTEL_EXPORTER_JAEGER_ENDPOINT: "http://jaeger:14250"
232-
OTEL_METRICS_EXPORTER: "prometheus"
233-
OTEL_EXPORTER_PROMETHEUS_HOST: "0.0.0.0"
234-
OTEL_EXPORTER_PROMETHEUS_PORT: "9464"
235-
OTEL_LOGS_EXPORTER: "otlp"
236-
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: "http://collector:4317"
228+
# environment:
229+
# OTEL_TRACES_EXPORTER: "jaeger"
230+
# OTEL_SERVICE_NAME: "webhooks-client"
231+
# OTEL_EXPORTER_JAEGER_ENDPOINT: "http://jaeger:14250"
232+
# OTEL_METRICS_EXPORTER: "prometheus"
233+
# OTEL_EXPORTER_PROMETHEUS_HOST: "0.0.0.0"
234+
# OTEL_EXPORTER_PROMETHEUS_PORT: "9464"
235+
# OTEL_LOGS_EXPORTER: "otlp"
236+
# OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: "http://collector:4317"
237237
depends_on:
238238
keycloak:
239239
condition: service_healthy

0 commit comments

Comments
 (0)