Skip to content

Commit

Permalink
Merge pull request #111 from Tiketeer/feat/DEV-141
Browse files Browse the repository at this point in the history
[DEV-141] 가시성 확보를 위한 작업
  • Loading branch information
punkryn authored Jun 19, 2024
2 parents 4f1f8d5 + e45e5df commit fd2ab99
Show file tree
Hide file tree
Showing 11 changed files with 1,439 additions and 28 deletions.
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
FROM curlimages/curl:8.2.1 AS download
ARG OTEL_AGENT_VERSION="1.33.2"
RUN curl --silent --fail -L "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${OTEL_AGENT_VERSION}/opentelemetry-javaagent.jar" \
-o "$HOME/opentelemetry-javaagent.jar"

FROM eclipse-temurin:21 AS build
COPY gradlew .
COPY gradle gradle
Expand All @@ -10,4 +15,8 @@ RUN ./gradlew bootJar
FROM eclipse-temurin:21
COPY --from=build build/libs/*.jar app.jar

ENTRYPOINT ["java", "-jar", "/app.jar"]
COPY --from=download /home/curl_user/opentelemetry-javaagent.jar /opentelemetry-javaagent.jar
ENTRYPOINT ["java", \
"-javaagent:/opentelemetry-javaagent.jar", \
"-jar", "/app.jar" \
]
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ dependencies {
// ETC
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.3.0'

// OBSERVABILITY
implementation 'io.micrometer:micrometer-registry-prometheus:1.11.3'
implementation 'io.opentelemetry:opentelemetry-api'
implementation 'org.springframework.boot:spring-boot-starter-actuator'

// MAIL
implementation 'org.springframework.boot:spring-boot-starter-mail'

Expand Down
135 changes: 135 additions & 0 deletions docker-compose.observe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
version: '3.8'

services:
was-b:
build: .
expose:
- 4000
depends_on:
- mysql
- redis
restart: unless-stopped
networks:
- common-network
environment:
- SPRING_CONFIG_LOCATION=file:///etc/additional.yml
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317
- OTEL_SERVICE_NAME=was-b # service name for Span
- OTEL_RESOURCE_ATTRIBUTES=compose_service=was-b # add custom resource attribute to Span for Grafana Trace to Logs feature
- OTEL_METRICS_EXPORTER=none # disable metrics exporter
- MANAGEMENT_METRICS_TAGS_APPLICATION=was-b # override default value of management.metrics.tags.application in app/src/main/resources/application.properties
volumes:
- ./src/main/resources/application-prod.yml:/etc/additional.yml

nginx:
image: nginx:latest
restart: unless-stopped
ports:
- 8888:8888
volumes:
- ./nginx.observe.conf:/etc/nginx/nginx.conf
depends_on:
- was-b
- was-waiting
networks:
- common-network

mysql:
image: mysql:8.0.33
expose:
- 3306
volumes:
- ./db/mysql/data:/var/lib/mysql
- ./db/mysql/init:/docker-entrypoint-initdb.d
command:
- '--character-set-server=utf8mb4'
- '--collation-server=utf8mb4_unicode_ci'
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_DATABASE: ${DB_DATABASE}
restart: unless-stopped
networks:
- common-network

redis:
image: redis:6.2-alpine
expose:
- 6379
environment:
REDIS_PASSWORD: '${REDIS_PASSWORD}'
command: redis-server /usr/local/etc/redis/redis.conf --save 20 1 --loglevel warning --requirepass $REDIS_PASSWORD
volumes:
- ./db/redis/data:/data
- ./redis.conf:/usr/local/etc/redis/redis.conf
restart: unless-stopped
networks:
- common-network

was-waiting:
image: tiketeer-waiting
expose:
- 8080
depends_on:
- mysql
- redis
restart: unless-stopped
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317 # send traces to Tempo
- OTEL_SERVICE_NAME=was-waiting # service name for Span
- OTEL_RESOURCE_ATTRIBUTES=compose_service=was-waiting # add custom resource attribute to Span for Grafana Trace to Logs feature
- OTEL_METRICS_EXPORTER=none # disable metrics exporter
- MANAGEMENT_METRICS_TAGS_APPLICATION=was-waiting # override default value of management.metrics.tags.application in app/src/main/resources/application.properties
networks:
- common-network

loki:
image: grafana/loki:3.0.0
command: -config.file=/etc/loki/local-config.yaml
ports:
- "3100:3100"
networks:
- common-network

prometheus:
image: prom/prometheus:v2.51.2
ports:
- "9090:9090"
volumes:
- ./etc/prometheus:/workspace
command:
- --config.file=/workspace/prometheus.yml
- --enable-feature=exemplar-storage
depends_on:
- loki
networks:
- common-network

tempo:
image: grafana/tempo:2.4.1
command: [ "--target=all", "--storage.trace.backend=local", "--storage.trace.local.path=/var/tempo", "--auth.enabled=false" ]
ports:
- "14250:14250"
- "4317:4317"
depends_on:
- loki
networks:
- common-network

grafana:
image: grafana/grafana:10.4.2
ports:
- "5000:3000"
volumes:
- ./etc/grafana/:/etc/grafana/provisioning/datasources
- ./etc/dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml
- ./etc/dashboards:/etc/grafana/dashboards
depends_on:
- loki
- prometheus
networks:
- common-network

networks:
common-network:
driver: bridge

10 changes: 10 additions & 0 deletions etc/dashboards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: 1
providers:
- name: 'Spring Boot Observability Test'
orgId: 1
folder: ''
type: 'file'
disableDeletion: true
editable: true
options:
path: '/etc/grafana/dashboards'
Loading

0 comments on commit fd2ab99

Please sign in to comment.