Yomu
Deployment

Observabilitas

Stack observabilitas penuh — metrics, logs, traces, alerting, dan dashboards

Platform Yomu mengekspos tiga pilar observabilitas (metrics, logs, traces) melalui stack Grafana yang berjalan pada VPS.

Three Pillars

Metrics (Prometheus)

Prometheus melakukan scrape pada seluruh layanan setiap 15 detik.

JobTargetPathLabels
prometheusprometheus:9090/metricsenv: infrastructure
traefiktraefik:8080/metricsenv: infrastructure
javajava:8080/actuator/prometheusenv: production, service: java
java-stagingjava-staging:8080/actuator/prometheusenv: staging, service: java
rustrust:8080/metricsenv: production, service: rust
rust-stagingrust-staging:8080/metricsenv: staging, service: rust
frontendfrontend:3000/api/metricsenv: production, service: frontend
frontend-stagingfrontend-staging:3000/api/metricsenv: staging, service: frontend
cadvisorcadvisor:8080/metricsenv: infrastructure, service: cadvisor
node-exporternode-exporter:9100/metricsenv: infrastructure, service: node
postgrespostgres-exporter:9187/metricsenv: infrastructure, service: postgres
redisredis-exporter:9121/metricsenv: infrastructure, service: redis

Alert Rules

# prometheus/rules/alerts.yml
groups:
  - name: yomu-alerts
    rules:
      - alert: ServiceDown
        expr: up == 0
        for: 1m
        annotations:
          summary: "Service {{ $labels.job }} down"
          description: "{{ $labels.job }} tidak merespon selama 1 menit"
      
      - alert: HighErrorRate
        expr: rate(traefik_service_requests_total{code=~"5.."}[5m]) > 0.1
        for: 5m
        annotations:
          summary: "High error rate detected"
          description: "Error rate > 10% pada {{ $labels.service }}"
      
      - alert: JavaHeapHigh
        expr: jvm_memory_used_bytes / jvm_memory_max_bytes > 0.85
        for: 5m
        annotations:
          summary: "JVM heap usage high"
          description: "Heap usage > 85% pada {{ $labels.job }}"
      
      - alert: ContainerHighCPU
        expr: rate(container_cpu_usage_seconds_total[5m]) > 0.8
        for: 5m
        annotations:
          summary: "Container CPU usage high"
          description: "CPU usage > 80% pada {{ $labels.name }}"
      
      - alert: ContainerHighMemory
        expr: container_memory_usage_bytes / container_spec_memory_limit_bytes > 0.9
        for: 5m
        annotations:
          summary: "Container memory usage high"
          description: "Memory usage > 90% pada {{ $labels.name }}"
      
      - alert: HighLatency
        expr: histogram_quantile(0.95, rate(traefik_service_request_duration_seconds_bucket[5m])) > 2
        for: 5m
        annotations:
          summary: "High latency detected"
          description: "P95 latency > 2s pada {{ $labels.service }}"

Dashboard Metrics

Logs (Loki)

AspekDetail
StorageFilesystem local (/loki)
Retention7 hari
IngestOTEL Collector → loki:3100 via HTTP push
Ingest ProtocolOTLP logs dari semua aplikasi
Query LanguageLogQL

Contoh kueri LogQL di Grafana:

{service="java"} |= "ERROR"
{service="rust-staging"} |= "panic" | json
{service="frontend"} |= "API call failed"

Traces (Tempo)

AspekDetail
StorageFilesystem local (/tmp/tempo/traces)
Retention7 hari
IngestOTEL Collector → tempo:4317 via OTLP gRPC
QueryTraceQL via Grafana pada tempo:3200
Span MetricsTempo metrics_generator → remote-write ke Prometheus
Service GraphsOtomatis dibuat dari span data

Java Auto-Instrumentasi

Java backend menggunakan OTEL Java Agent yang sudah tertanam dalam Dockerfile:

-javaagent:/app/otel/opentelemetry-javaagent.jar
-Dotel.resource.attributes=service.name=java-backend
-Dotel.exporter.otlp.endpoint=http://otel-collector:4317

Rust / Frontend Manual Instrumentasi

Kirim traces ke OTEL Collector:

OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
OTEL_SERVICE_NAME=rust-backend

OTEL Collector Pipeline

PipelineReceiversExporters
TracesOTLPTempo, Logging
MetricsOTLPPrometheus Remote-Write, Logging
LogsOTLPLoki Push, Logging

Grafana Dashboards

Grafana tersedia di monitoring.yomu.my.id dengan dashboard berikut:

DashboardPanel Utama
Production OverviewRequest rate, error rate, p95 latency, JVM memory, Traefik throughput
Service HealthUp/down status per service, latency p50/p95/p99, error rate by status code, Traefik traffic metrics
Environment ComparisonProd vs Staging JVM heap, request rates, error rates, service up counts
Container MetricsCPU, memory, network usage per container (dari cAdvisor)
Host MetricsNode CPU, memory, disk I/O, network (dari node-exporter)

Semua dashboard diprovision secara otomatis pada saat Grafana pertama kali start.

Akses Dashboard

ServiceURLCredentials
Grafanahttps://monitoring.yomu.my.idadmin / password dari .env
Prometheushttps://monitoring.yomu.my.id/prometheusBasic auth (opsional)
TempoInternal only (via Grafana)
LokiInternal only (via Grafana)

On this page