Version 0.3.0
Some checks failed
Run linters on applied template / Python 3.13 lint and build (push) Failing after 2m36s

Changes:
- fix double exception message in main request_processing span
- add OpenSearch to Jaeger and OpenTelemetry Logs
- add optional OpenTelemetry Logs Exporter to structlog
- update deploy README
This commit is contained in:
2025-12-06 19:41:33 +03:00
parent 34c1347402
commit b8acb017fd
16 changed files with 966 additions and 450 deletions

6
deploy/Makefile Normal file
View File

@@ -0,0 +1,6 @@
up:
docker compose up --build -d
docker compose down database-init prometheus-init grafana-init opensearch-init migrator
down:
docker compose down

View File

@@ -15,9 +15,13 @@ db:
user: postgres
password: "!env(DB_PASSWORD)"
pool_size: 2
logging:
level: INFO
observability:
logging:
level: INFO
exporter:
endpoint: http://otel:4317
level: INFO
tls_insecure: true
prometheus:
host: 0.0.0.0
port: 9090

View File

@@ -0,0 +1,36 @@
service:
extensions: [jaeger_storage, jaeger_query]
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [jaeger_storage_exporter]
extensions:
jaeger_query:
storage:
traces: opensearch_trace_storage
metrics: opensearch_trace_storage
jaeger_storage:
backends:
opensearch_trace_storage: &opensearch_config
opensearch:
server_urls:
- http://opensearch:9200
metric_backends:
opensearch_trace_storage: *opensearch_config
receivers:
otlp:
protocols:
grpc:
endpoint: "0.0.0.0:4317"
http:
endpoint: "0.0.0.0:4318"
processors:
batch:
exporters:
jaeger_storage_exporter:
trace_storage: opensearch_trace_storage

View File

@@ -0,0 +1,8 @@
{
"monitor": {
"menuEnabled": true
},
"dependencies": {
"menuEnabled": true
}
}

View File

@@ -13,6 +13,24 @@ exporters:
insecure: true
debug:
verbosity: detailed
prometheusremotewrite:
endpoint: http://prometheus-pushgateway:9091/api/prom/push
tls:
insecure: true
opensearch:
http:
endpoint: http://opensearch:9200
# Logs configuration
logs_index: "otel-logs-%{service.name}"
logs_index_fallback: "default-service"
logs_index_time_format: "yyyy.MM.dd"
# Traces configuration
# traces_index: "otel-traces-%{service.name}"
# traces_index_fallback: "default-service"
# traces_index_time_format: "yyyy.MM.dd"
sending_queue:
batch:
processors:
batch:
@@ -24,7 +42,16 @@ service:
exporters: [debug, otlp/jaeger]
metrics:
receivers: [otlp]
exporters: [debug]
exporters: [debug, prometheusremotewrite]
logs:
receivers: [otlp]
exporters: [debug]
exporters: [debug, opensearch]
telemetry:
metrics:
readers:
- pull:
exporter:
prometheus:
host: '0.0.0.0'
port: 8888

View File

@@ -11,3 +11,12 @@ scrape_configs:
static_configs:
- targets:
- "{{project_name}}:9090"
- job_name: otel
static_configs:
- targets:
- "otel:8888"
- job_name: 'pushgateway'
honor_labels: true
static_configs:
- targets:
- "prometheus-pushgateway:9091"

View File

@@ -4,7 +4,7 @@ services:
# postgres database
database-init:
image: postgres:17
image: postgres:17 # or postgis/postgis:17-3.5
container_name: {{project_slug}}_db-init
volumes: &postgres-volumes
- ./data/postgres:/var/lib/postgresql/data
@@ -74,7 +74,7 @@ services:
otel: # optional
condition: service_started
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${PORT:-8080}/health_check/ping"]
test: ["CMD-SHELL", "curl -f http://localhost:${PORT:-8080}/health_check/ping"]
interval: 10s
timeout: 5s
start_period: 5s
@@ -83,30 +83,41 @@ services:
# prometheus + grafana monitoring
prometheus-init:
image: prom/prometheus:latest
image: alpine:3.23
container_name: prometheus-init
volumes: &prometheus-volumes-section
- ./configs/prometheus.yml:/etc/prometheus/prometheus.yml
- ./data/prometheus:/prometheus
entrypoint: ["chown", "-R", "65534:65534", "/prometheus"]
entrypoint: ["chown", "65534:65534", "-R", "/prometheus"]
user: "root"
prometheus-pushgateway:
image: prom/pushgateway:latest
container_name: prometheus-pushgateway
restart: unless-stopped
# ports:
# - 9091:9091
logging: *json-logging
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
ports:
- 9090:9090
depends_on:
prometheus-init:
condition: service_completed_successfully
volumes: *prometheus-volumes-section
logging: *json-logging
grafana-init:
image: grafana/grafana-enterprise:latest
image: alpine:3.23
container_name: grafana-init
volumes: &grafana-volumes-section
- ./data/grafana:/var/lib/grafana
user: "root"
entrypoint: ["chown", "-R", "472:0", "/var/lib/grafana"]
entrypoint: ["chown", "472:0", "-R", "/var/lib/grafana"]
grafana:
image: grafana/grafana-enterprise:latest
@@ -122,25 +133,74 @@ services:
# jaeger tracing
opensearch-init:
image: alpine:3.23
volumes: &opensearch-volumes-section
- ./data/opensearch:/usr/share/opensearch/data
entrypoint: ["chown", "1000:1000", "-R", "/usr/share/opensearch/data"]
user: "root"
opensearch:
image: opensearchproject/opensearch:3.3.0@sha256:d96afaf6cbd2a6a3695aeb2f1d48c9a16ad5c8918eb849e5cbf43475f0f8e146
container_name: opensearch
environment:
- discovery.type=single-node
- plugins.security.disabled=true
- http.host=0.0.0.0
- transport.host=127.0.0.1
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=admin-Password-1@-goes-here
# ports:
# - 9200:9200 # REST API
# - 9600:9600 # Performance Analyzer
volumes: *opensearch-volumes-section
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:9200 || exit 1" ]
interval: 10s
timeout: 10s
retries: 30
logging: *json-logging
# # Visualizer for opensearch data
# opensearch-dashboards:
# image: opensearchproject/opensearch-dashboards:latest
# container_name: marketplace_os_dashboards
# ports:
# - 5601:5601
# # expose:
# # - "5601"
# environment:
# OPENSEARCH_HOSTS: '["http://opensearch:9200"]'
# DISABLE_SECURITY_DASHBOARDS_PLUGIN: "true"
# depends_on:
# opensearch:
# condition: service_healthy
jaeger:
container_name: jaeger
image: cr.jaegertracing.io/jaegertracing/jaeger:2.11.0
image: cr.jaegertracing.io/jaegertracing/jaeger:2.12.0
ports:
- 16686:16686
# - 5778:5778
# - 9411:9411
volumes:
- ./configs/jaeger-ui.json:/etc/jaeger/jaeger-ui.json
- ./configs/jaeger-opensearch.yaml:/etc/jaeger/config.yml
command: ["--config", "/etc/jaeger/config.yml"]
depends_on:
opensearch:
condition: service_healthy
restart: unless-stopped
logging: *json-logging
otel:
container_name: otel
image: otel/opentelemetry-collector
image: otel/opentelemetry-collector-contrib
# ports:
# - 4317:4317
# - 4318:4318
restart: unless-stopped
volumes:
- ./configs/otel.yaml:/etc/otelcol/config.yaml
- ./configs/otel.yaml:/etc/otelcol-contrib/config.yaml
depends_on:
- jaeger
logging: *json-logging