Skip to content

Commit 2af6cde

Browse files
authored
Merge pull request #31 from Nasruddin/revamp
Observability - Loki, Tempo, Prometheus with Grafana added
2 parents 9929f24 + 4156609 commit 2af6cde

File tree

12 files changed

+96
-32
lines changed

12 files changed

+96
-32
lines changed

Diff for: .idea/workspace.xml

+23-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: docker/docker-compose-base.yml

+26
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ services:
44
mem_limit: 512m
55
environment:
66
- SPRING_PROFILES_ACTIVE=docker
7+
- 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.
8+
- OTEL_TRACES_EXPORTER=otlp
9+
- OTEL_METRICS_EXPORTER=none
10+
- OTEL_LOGS_EXPORTER=none
11+
- OTEL_METRIC_EXPORT_INTERVAL=15000
12+
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
713
logging:
814
driver: fluentd
915
options:
@@ -19,6 +25,12 @@ services:
1925
mem_limit: 512m
2026
environment:
2127
- SPRING_PROFILES_ACTIVE=docker
28+
- 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.
29+
- OTEL_TRACES_EXPORTER=otlp
30+
- OTEL_METRICS_EXPORTER=none
31+
- OTEL_LOGS_EXPORTER=none
32+
- OTEL_METRIC_EXPORT_INTERVAL=15000
33+
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
2234
logging:
2335
driver: fluentd
2436
options:
@@ -36,6 +48,14 @@ services:
3648
- "8080:8080"
3749
environment:
3850
- SPRING_PROFILES_ACTIVE=docker
51+
- 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.
52+
- OTEL_TRACES_EXPORTER=otlp
53+
- OTEL_METRICS_EXPORTER=none
54+
- OTEL_LOGS_EXPORTER=none
55+
- OTEL_METRIC_EXPORT_INTERVAL=15000
56+
- OTEL_INSTRUMENTATION_SPRING_WEB_EXCLUDE_PATTERNS=/actuator/prometheus
57+
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
58+
3959
logging:
4060
driver: fluentd
4161
options:
@@ -50,6 +70,12 @@ services:
5070
- "9000:9000"
5171
environment:
5272
- SPRING_PROFILES_ACTIVE=docker
73+
- 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.
74+
- OTEL_TRACES_EXPORTER=otlp
75+
- OTEL_METRICS_EXPORTER=none
76+
- OTEL_LOGS_EXPORTER=none
77+
- OTEL_METRIC_EXPORT_INTERVAL=15000
78+
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4318
5379
logging:
5480
driver: fluentd
5581
options:

Diff for: docker/docker-compose-observability.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ services:
4848
networks:
4949
- shared-network
5050
tempo:
51-
image: grafana/tempo:1.5.0
51+
image: grafana/tempo:latest
5252
command: -config.file /etc/tempo-config.yml
5353
ports:
54-
- "4317:4317"
54+
- "4317:4317" # OTLP gRPC
55+
- "4318:4318" # OTLP HTTP
56+
- "3200:3200" # Tempo HTTP server (for querying)
5557
volumes:
5658
- ./tempo/tempo.yml:/etc/tempo-config.yml
59+
networks:
60+
- shared-network
5761

5862
networks:
5963
shared-network:

Diff for: docker/fluent-bit/parsers.conf

-12
This file was deleted.

Diff for: docker/tempo/tempo.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
server:
2+
http_listen_address: 0.0.0.0
3+
http_listen_port: 3200
4+
5+
distributor:
6+
receivers:
7+
otlp:
8+
protocols:
9+
grpc:
10+
endpoint: 0.0.0.0:4317
11+
http:
12+
endpoint: 0.0.0.0:4318
13+
14+
storage:
15+
trace:
16+
backend: local
17+
local:
18+
path: /tmp/tempo/blocks
19+
20+
usage_report:
21+
reporting_enabled: false

Diff for: microservices/course-composite-service/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
<artifactId>logback-classic</artifactId>
7272
</dependency>
7373

74+
<dependency>
75+
<groupId>io.opentelemetry.javaagent</groupId>
76+
<artifactId>opentelemetry-javaagent</artifactId>
77+
<version>2.13.3</version>
78+
</dependency>
79+
7480
<dependency>
7581
<groupId>org.springframework.boot</groupId>
7682
<artifactId>spring-boot-starter-test</artifactId>

Diff for: microservices/course-composite-service/src/main/java/io/javatab/microservices/composite/course/web/CourseAggregateController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public CourseAggregateController(CourseCompositeIntegration integration) {
2929

3030
@GetMapping("/{id}/with-details")
3131
public Mono<CourseAggregate> getCourses(@PathVariable Long id, @AuthenticationPrincipal Jwt jwt) {
32-
logger.info("Fetching course and review details for course id : {}", id);
32+
logger.info("Fetching course and review details for course id ===> {}", id);
3333
return integration.getCourseDetails(id, jwt);
3434
}
3535
}

Diff for: microservices/course-composite-service/src/main/resources/application.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ logging:
1515
root: INFO
1616
io.javatab.microservices.composite.course: DEBUG
1717
pattern:
18-
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-N/A}] [%X{spanId:-N/A}] %-5level %logger{36} - %msg%n"
18+
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"
1919

2020

2121
# Security related properties

Diff for: microservices/course-service/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@
8686
<groupId>io.micrometer</groupId>
8787
<artifactId>micrometer-registry-prometheus</artifactId>
8888
</dependency>
89+
<dependency>
90+
<groupId>io.opentelemetry.javaagent</groupId>
91+
<artifactId>opentelemetry-javaagent</artifactId>
92+
<version>2.13.3</version>
93+
</dependency>
8994
<dependency>
9095
<groupId>org.springframework.boot</groupId>
9196
<artifactId>spring-boot-starter-test</artifactId>

Diff for: microservices/course-service/src/main/resources/application.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ logging:
3232
root: INFO
3333
io.javatab.microservices.core.course: DEBUG
3434
pattern:
35-
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-N/A}] [%X{spanId:-N/A}] %-5level %logger{36} - %msg%n"
35+
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"
3636

3737
management:
3838
endpoints:

Diff for: microservices/review-service/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@
7878
<groupId>io.micrometer</groupId>
7979
<artifactId>micrometer-registry-prometheus</artifactId>
8080
</dependency>
81+
<dependency>
82+
<groupId>io.opentelemetry.javaagent</groupId>
83+
<artifactId>opentelemetry-javaagent</artifactId>
84+
<version>2.13.3</version>
85+
</dependency>
8186
<dependency>
8287
<groupId>org.springframework.boot</groupId>
8388
<artifactId>spring-boot-starter-test</artifactId>

Diff for: microservices/review-service/src/main/resources/application.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ logging:
2525
root: INFO
2626
io.javatab.microservices.composite.review: DEBUG
2727
pattern:
28-
console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId:-N/A}] [%X{spanId:-N/A}] %-5level %logger{36} - %msg%n"
28+
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"
2929
management:
3030
endpoints:
3131
web:

0 commit comments

Comments
 (0)