]> git.frustrated-labs.net Git - larousseapi/commitdiff
feat: configure quarkus support for otel
authorAlexander Goussas <[email protected]>
Mon, 25 May 2026 01:01:45 +0000 (20:01 -0500)
committerAlexander Goussas <[email protected]>
Mon, 25 May 2026 01:01:45 +0000 (20:01 -0500)
build.gradle
docker-compose.yml [new file with mode: 0644]
docker/otel/otel-config.yaml [new file with mode: 0644]
docker/prometheus/prometheus.yml [new file with mode: 0644]
docker/tempo/tempo.yaml [new file with mode: 0644]
src/main/resources/application.properties

index ad1d4157f2f197b6d913c7c625e9f3eb82550888..b5a4601271c053905e1f92ff8723d4585f60c1db 100644 (file)
@@ -9,6 +9,8 @@ repositories {
 }
 
 dependencies {
+    implementation 'io.quarkus:quarkus-micrometer-opentelemetry'
+    implementation 'io.quarkus:quarkus-opentelemetry'
     implementation 'io.quarkus:quarkus-kubernetes'
     implementation 'io.quarkus:quarkus-container-image-docker'
     implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..77f136f
--- /dev/null
@@ -0,0 +1,37 @@
+services:
+  otel-collector:
+    image: otel/opentelemetry-collector:latest
+    command: [ "--config=/etc/otel-config.yaml" ]
+    volumes:
+      - ./docker/otel/otel-config.yaml:/etc/otel-config.yaml
+    ports:
+      - "4317:4317"
+      - "4318:4318"
+      - "8887:8887"
+
+  prometheus:
+    image: prom/prometheus:latest
+    container_name: larousse-api-prometheus
+    restart: unless-stopped
+    ports:
+      - "9090:9090"
+    volumes:
+      - ./docker/prometheus:/etc/prometheus
+
+  tempo:
+    image: grafana/tempo:2.10.5
+    command: [ "-config.file=/etc/tempo.yaml" ]
+    volumes:
+      - ./docker/tempo/tempo.yaml:/etc/tempo.yaml
+    ports:
+      - "4317" # otlp grpc
+
+  grafana:
+    image: grafana/grafana:latest
+    container_name: larousse-api-grafana
+    restart: unless-stopped
+    ports:
+      - "3000:3000"
+    environment:
+      GF_SECURITY_ADMIN_USER: admin
+      GF_SECURITY_ADMIN_PASSWORD: admin
\ No newline at end of file
diff --git a/docker/otel/otel-config.yaml b/docker/otel/otel-config.yaml
new file mode 100644 (file)
index 0000000..6ad155b
--- /dev/null
@@ -0,0 +1,24 @@
+receivers:
+  otlp:
+    protocols:
+      grpc:
+        endpoint: 0.0.0.0:4317
+      http:
+        endpoint: 0.0.0.0:4318
+
+exporters:
+  prometheus:
+    endpoint: "0.0.0.0:8887"
+  otlp/tempo:
+    endpoint: "tempo:4317"
+    tls:
+      insecure: true
+
+service:
+  pipelines:
+    metrics:
+      receivers: [ otlp ]
+      exporters: [ prometheus ]
+    traces:
+      receivers: [ otlp ]
+      exporters: [ otlp/tempo ]
\ No newline at end of file
diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml
new file mode 100644 (file)
index 0000000..b4056db
--- /dev/null
@@ -0,0 +1,7 @@
+global:
+  scrape_interval: 5s
+
+scrape_configs:
+  - job_name: "otel-collector"
+    static_configs:
+      - targets: [ "otel-collector:8887" ]
\ No newline at end of file
diff --git a/docker/tempo/tempo.yaml b/docker/tempo/tempo.yaml
new file mode 100644 (file)
index 0000000..01d13b8
--- /dev/null
@@ -0,0 +1,55 @@
+stream_over_http_enabled: true
+server:
+  http_listen_port: 3200
+  log_level: info
+
+query_frontend:
+  search:
+    duration_slo: 5s
+    throughput_bytes_slo: 1.073741824e+09
+    metadata_slo:
+      duration_slo: 5s
+      throughput_bytes_slo: 1.073741824e+09
+  trace_by_id:
+    duration_slo: 5s
+
+distributor:
+  receivers:
+    otlp:
+      protocols:
+        grpc:
+          endpoint: "tempo:4317"
+
+ingester:
+  max_block_duration: 5m # cut the headblock when this much time passes. this is being set for demo purposes and should probably be left alone normally
+
+compactor:
+  compaction:
+    block_retention: 1h # overall Tempo trace retention. set for demo purposes
+
+metrics_generator:
+  registry:
+    external_labels:
+      source: tempo
+      cluster: docker-compose
+  storage:
+    path: /var/tempo/generator/wal
+    remote_write:
+      - url: http://prometheus:9090/api/v1/write
+        send_exemplars: true
+  traces_storage:
+    path: /var/tempo/generator/traces
+
+storage:
+  trace:
+    backend: local # backend configuration to use
+    wal:
+      path: /var/tempo/wal # where to store the wal locally
+    local:
+      path: /var/tempo/blocks
+
+overrides:
+  defaults:
+    metrics_generator:
+      processors: [ service-graphs, span-metrics, local-blocks ] # enables metrics generator
+      generate_native_histograms: both
\ No newline at end of file
index f650fb39676e7b551e972501f81c8d1a6d65c59f..5860cd8384965a50ce1fb7acbc4cebee426a3feb 100644 (file)
@@ -3,4 +3,8 @@ quarkus.container-image.push=true
 quarkus.container-image.group=aloussase69
 quarkus.docker.buildx.platform=linux/amd64
 quarkus.kubernetes.namespace=default
-quarkus.kubernetes.service-type=node-port
\ No newline at end of file
+quarkus.kubernetes.service-type=node-port
+quarkus.otel.exporter.otlp.endpoint=http://localhost:4317
+quarkus.application.name=larousse-api
+quarkus.otel.simple=true
+%prod.quarkus.otel.simple=false