Skip to content

Observability - Loki, Tempo, Prometheus with Grafana added #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions docker/docker-compose-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ services:
mem_limit: 512m
environment:
- SPRING_PROFILES_ACTIVE=docker
- JAVA_TOOL_OPTIONS="-javaagent:/application/BOOT-INF/lib/opentelemetry-javaagent-2.13.3.jar" #maven will place jar in BOOT-INF as per dep mentioned in pom. This will instruct the JVM to run the OpenTelemetry Java agent from the path.
- OTEL_TRACES_EXPORTER=otlp
- OTEL_METRICS_EXPORTER=none
- OTEL_LOGS_EXPORTER=none
- OTEL_METRIC_EXPORT_INTERVAL=15000
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
logging:
driver: fluentd
options:
Expand All @@ -19,6 +25,12 @@ services:
mem_limit: 512m
environment:
- SPRING_PROFILES_ACTIVE=docker
- JAVA_TOOL_OPTIONS="-javaagent:/application/BOOT-INF/lib/opentelemetry-javaagent-2.13.3.jar" #maven will place jar in BOOT-INF as per dep mentioned in pom. This will instruct the JVM to run the OpenTelemetry Java agent from the path.
- OTEL_TRACES_EXPORTER=otlp
- OTEL_METRICS_EXPORTER=none
- OTEL_LOGS_EXPORTER=none
- OTEL_METRIC_EXPORT_INTERVAL=15000
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
logging:
driver: fluentd
options:
Expand All @@ -36,6 +48,14 @@ services:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=docker
- JAVA_TOOL_OPTIONS="-javaagent:/application/BOOT-INF/lib/opentelemetry-javaagent-2.13.3.jar" #maven will place jar in BOOT-INF as per dep mentioned in pom. This will instruct the JVM to run the OpenTelemetry Java agent from the path.
- OTEL_TRACES_EXPORTER=otlp
- OTEL_METRICS_EXPORTER=none
- OTEL_LOGS_EXPORTER=none
- OTEL_METRIC_EXPORT_INTERVAL=15000
- OTEL_INSTRUMENTATION_SPRING_WEB_EXCLUDE_PATTERNS=/actuator/prometheus
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318

logging:
driver: fluentd
options:
Expand All @@ -50,6 +70,12 @@ services:
- "9000:9000"
environment:
- SPRING_PROFILES_ACTIVE=docker
- JAVA_TOOL_OPTIONS="-javaagent:/application/BOOT-INF/lib/opentelemetry-javaagent-2.13.3.jar" #maven will place jar in BOOT-INF as per dep mentioned in pom. This will instruct the JVM to run the OpenTelemetry Java agent from the path.
- OTEL_TRACES_EXPORTER=otlp
- OTEL_METRICS_EXPORTER=none
- OTEL_LOGS_EXPORTER=none
- OTEL_METRIC_EXPORT_INTERVAL=15000
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
logging:
driver: fluentd
options:
Expand Down
8 changes: 6 additions & 2 deletions docker/docker-compose-observability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ services:
networks:
- shared-network
tempo:
image: grafana/tempo:1.5.0
image: grafana/tempo:latest
command: -config.file /etc/tempo-config.yml
ports:
- "4317:4317"
- "4317:4317" # OTLP gRPC
- "4318:4318" # OTLP HTTP
- "3200:3200" # Tempo HTTP server (for querying)
volumes:
- ./tempo/tempo.yml:/etc/tempo-config.yml
networks:
- shared-network

networks:
shared-network:
Expand Down
12 changes: 0 additions & 12 deletions docker/fluent-bit/parsers.conf

This file was deleted.

21 changes: 21 additions & 0 deletions docker/tempo/tempo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
server:
http_listen_address: 0.0.0.0
http_listen_port: 3200

distributor:
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318

storage:
trace:
backend: local
local:
path: /tmp/tempo/blocks

usage_report:
reporting_enabled: false
6 changes: 6 additions & 0 deletions microservices/course-composite-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
<artifactId>logback-classic</artifactId>
</dependency>

<dependency>
<groupId>io.opentelemetry.javaagent</groupId>
<artifactId>opentelemetry-javaagent</artifactId>
<version>2.13.3</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public CourseAggregateController(CourseCompositeIntegration integration) {

@GetMapping("/{id}/with-details")
public Mono<CourseAggregate> getCourses(@PathVariable Long id, @AuthenticationPrincipal Jwt jwt) {
logger.info("Fetching course and review details for course id : {}", id);
logger.info("Fetching course and review details for course id ===> {}", id);
return integration.getCourseDetails(id, jwt);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ logging:
root: INFO
io.javatab.microservices.composite.course: DEBUG
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-N/A}] [%X{spanId:-N/A}] %-5level %logger{36} - %msg%n"
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{trace_id:-N/A}] [%X{span_id:-N/A}] %-5level %logger{36} - %msg%n"


# Security related properties
Expand Down
5 changes: 5 additions & 0 deletions microservices/course-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.javaagent</groupId>
<artifactId>opentelemetry-javaagent</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ logging:
root: INFO
io.javatab.microservices.core.course: DEBUG
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-N/A}] [%X{spanId:-N/A}] %-5level %logger{36} - %msg%n"
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{trace_id:-N/A}] [%X{span_id:-N/A}] %-5level %logger{36} - %msg%n"

management:
endpoints:
Expand Down
5 changes: 5 additions & 0 deletions microservices/review-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.javaagent</groupId>
<artifactId>opentelemetry-javaagent</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ logging:
root: INFO
io.javatab.microservices.composite.review: DEBUG
pattern:
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-N/A}] [%X{spanId:-N/A}] %-5level %logger{36} - %msg%n"
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{trace_id:-N/A}] [%X{span_id:-N/A}] %-5level %logger{36} - %msg%n"
management:
endpoints:
web:
Expand Down
Loading