Skip to content

Commit

Permalink
replaced opentelemetry java agent with spring boot actuator, loki log…
Browse files Browse the repository at this point in the history
…back appender, and spring tempo
  • Loading branch information
harshaghanta committed Jan 12, 2025
1 parent 7338791 commit f447485
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 35 deletions.
3 changes: 1 addition & 2 deletions src/Services/Webhooks/webhooks-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,14 @@ RUN mvn -f /src/Services/Webhooks/webhooks-client/pom.xml -s /src/settings.xml p
FROM base AS final
WORKDIR /app
COPY --from=build /src/Services/Webhooks/webhooks-client/target/webhooks-client.jar ./webhooks-client.jar
COPY --from=build /src/Services/Webhooks/webhooks-client/target/opentelemetry-javaagent.jar ./opentelemetry-javaagent.jar

# CMD tail -f /dev/null

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



23 changes: 1 addition & 22 deletions src/Services/Webhooks/webhooks-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.opentelemetry.javaagent</groupId>
<artifactId>opentelemetry-javaagent</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
c -> c.requestMatchers("/checkpost").permitAll()
.requestMatchers("/check").permitAll()
.requestMatchers("/webhook-received").permitAll()
.requestMatchers("/actuator/**").permitAll()
.requestMatchers("/").permitAll()
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.anyRequest().authenticated())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
spring.profiles.active: dev
spring.application.name: webhooks-client
spring:
application:
name: webhooks-client
profiles:
active:
- dev

#enable management endpoints
management:
metrics:
distribution:
percentiles-histogram:
http:
server:
requests: true
tracing:
sampling:
probability: 1.0

endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: always

prometheus:
metrics:
export:
enabled: true

zipkin:
tracing:
endpoint: http://tempo:9411/api/v2/spans

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

Expand Down
3 changes: 3 additions & 0 deletions src/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ services:
webhooks-api:
environment:
SERVER_SERVLET_CONTEXT_PATH: "/webhooks-api"
webhooks-client:
environment:
SERVER_SERVLET_CONTEXT_PATH: "/webhooks-client"


18 changes: 9 additions & 9 deletions src/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ services:
image: ${REGISTRY:-springeshop}/webhooksclient:latest
env_file:
- .env
environment:
OTEL_TRACES_EXPORTER: "jaeger"
OTEL_SERVICE_NAME: "webhooks-api"
OTEL_EXPORTER_JAEGER_ENDPOINT: "http://jaeger:14250"
OTEL_METRICS_EXPORTER: "prometheus"
OTEL_EXPORTER_PROMETHEUS_HOST: "0.0.0.0"
OTEL_EXPORTER_PROMETHEUS_PORT: "9464"
OTEL_LOGS_EXPORTER: "otlp"
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: "http://collector:4317"
# environment:
# OTEL_TRACES_EXPORTER: "jaeger"
# OTEL_SERVICE_NAME: "webhooks-client"
# OTEL_EXPORTER_JAEGER_ENDPOINT: "http://jaeger:14250"
# OTEL_METRICS_EXPORTER: "prometheus"
# OTEL_EXPORTER_PROMETHEUS_HOST: "0.0.0.0"
# OTEL_EXPORTER_PROMETHEUS_PORT: "9464"
# OTEL_LOGS_EXPORTER: "otlp"
# OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: "http://collector:4317"
depends_on:
keycloak:
condition: service_healthy
Expand Down

0 comments on commit f447485

Please sign in to comment.