Проект разделен на два репозитория
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
services:
|
||||
otel-queue-init:
|
||||
image: alpine:3.21.2
|
||||
command: ["sh", "-c", "chown 10001:10001 /queue && chmod 0700 /queue"]
|
||||
volumes:
|
||||
- otel-queue:/queue
|
||||
networks: [observability]
|
||||
restart: "no"
|
||||
read_only: true
|
||||
cap_drop: ["ALL"]
|
||||
cap_add: ["CHOWN", "FOWNER"]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
|
||||
otel-collector:
|
||||
image: otel/opentelemetry-collector-contrib:0.117.0
|
||||
command: ["--config=/etc/otelcol/config.yaml"]
|
||||
environment:
|
||||
APP_ENV: ${APP_ENV:-production-like}
|
||||
RELEASE_VERSION: ${RELEASE_VERSION:-unknown}
|
||||
OTEL_REMOTE_ENDPOINT: ${OTEL_REMOTE_ENDPOINT}
|
||||
OTEL_REMOTE_TLS_INSECURE: ${OTEL_REMOTE_TLS_INSECURE:-false}
|
||||
expose: ["4317", "4318", "13133", "8888"]
|
||||
volumes:
|
||||
- ./otel-collector.yaml:/etc/otelcol/config.yaml:ro
|
||||
- otel-queue:/var/lib/otelcol/queue
|
||||
secrets:
|
||||
- otel_remote_auth_header
|
||||
networks: [observability, egress]
|
||||
depends_on:
|
||||
otel-queue-init: {condition: service_completed_successfully}
|
||||
healthcheck:
|
||||
test: ["CMD", "/otelcol-contrib", "validate", "--config=/etc/otelcol/config.yaml"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
tmpfs: ["/tmp:size=32m,mode=1777"]
|
||||
user: "10001:10001"
|
||||
cap_drop: ["ALL"]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
ulimits:
|
||||
core: {soft: 0, hard: 0}
|
||||
mem_limit: 512m
|
||||
cpus: 0.5
|
||||
logging:
|
||||
driver: json-file
|
||||
options: {max-size: "50m", max-file: "5"}
|
||||
|
||||
otel-collector-local:
|
||||
image: otel/opentelemetry-collector-contrib:0.117.0
|
||||
profiles: ["observability-local"]
|
||||
command: ["--config=/etc/otelcol/config.yaml"]
|
||||
expose: ["4317", "4318", "13133"]
|
||||
volumes:
|
||||
- ./otel-collector.local.yaml:/etc/otelcol/config.yaml:ro
|
||||
networks: [observability]
|
||||
healthcheck:
|
||||
test: ["CMD", "/otelcol-contrib", "validate", "--config=/etc/otelcol/config.yaml"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
read_only: true
|
||||
tmpfs: ["/tmp:size=16m,mode=1777"]
|
||||
user: "10001:10001"
|
||||
cap_drop: ["ALL"]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
|
||||
secrets:
|
||||
otel_remote_auth_header:
|
||||
file: ${HAN_SECRETS_DIR:-/run/han-chat/secrets}/OTEL_REMOTE_AUTH_HEADER
|
||||
@@ -0,0 +1,45 @@
|
||||
extensions:
|
||||
health_check: {endpoint: 0.0.0.0:13133}
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc: {endpoint: 0.0.0.0:4317}
|
||||
http: {endpoint: 0.0.0.0:4318}
|
||||
|
||||
processors:
|
||||
memory_limiter: {check_interval: 1s, limit_mib: 192, spike_limit_mib: 48}
|
||||
resource/common:
|
||||
attributes:
|
||||
- {key: service.namespace, value: han-chat, action: upsert}
|
||||
- {key: deployment.environment, value: local, action: upsert}
|
||||
attributes/redact:
|
||||
actions:
|
||||
- {key: http.request.header.authorization, action: delete}
|
||||
- {key: http.request.header.cookie, action: delete}
|
||||
- {key: url.query, action: delete}
|
||||
- {key: db.statement, action: delete}
|
||||
- {key: messaging.message.body, action: delete}
|
||||
batch: {timeout: 5s}
|
||||
|
||||
exporters:
|
||||
debug:
|
||||
verbosity: normal
|
||||
sampling_initial: 2
|
||||
sampling_thereafter: 500
|
||||
|
||||
service:
|
||||
extensions: [health_check]
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, resource/common, attributes/redact, batch]
|
||||
exporters: [debug]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, resource/common, attributes/redact, batch]
|
||||
exporters: [debug]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, resource/common, attributes/redact, batch]
|
||||
exporters: [debug]
|
||||
@@ -0,0 +1,135 @@
|
||||
extensions:
|
||||
health_check:
|
||||
endpoint: 0.0.0.0:13133
|
||||
file_storage:
|
||||
directory: /var/lib/otelcol/queue
|
||||
timeout: 10s
|
||||
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc: {endpoint: 0.0.0.0:4317}
|
||||
http: {endpoint: 0.0.0.0:4318}
|
||||
prometheus:
|
||||
config:
|
||||
scrape_configs:
|
||||
- job_name: otel-collector
|
||||
static_configs:
|
||||
- targets: ["127.0.0.1:8888"]
|
||||
- job_name: sms-service
|
||||
scrape_interval: 15s
|
||||
scrape_timeout: 10s
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets: ["sms-service:8080"]
|
||||
labels: {service_name: sms-service}
|
||||
- job_name: sms-worker
|
||||
scrape_interval: 15s
|
||||
scrape_timeout: 10s
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets: ["sms-worker:9464"]
|
||||
labels: {service_name: sms-worker}
|
||||
- job_name: keycloak
|
||||
scrape_interval: 30s
|
||||
scrape_timeout: 15s
|
||||
metrics_path: /auth/metrics
|
||||
static_configs:
|
||||
- targets: ["keycloak:9000"]
|
||||
labels: {service_name: keycloak}
|
||||
metric_relabel_configs:
|
||||
- action: keep
|
||||
source_labels: [__name__]
|
||||
regex: "(keycloak_.*|jvm_.*|process_.*|system_.*|agroal_.*)"
|
||||
- action: labeldrop
|
||||
regex: "(client_id|uri|session_id|user_id|phone|email)"
|
||||
|
||||
processors:
|
||||
memory_limiter:
|
||||
check_interval: 1s
|
||||
limit_mib: 384
|
||||
spike_limit_mib: 96
|
||||
resource/common:
|
||||
attributes:
|
||||
- {key: service.namespace, value: han-chat, action: upsert}
|
||||
- {key: deployment.environment, value: "${env:APP_ENV}", action: upsert}
|
||||
- {key: service.version, value: "${env:RELEASE_VERSION}", action: upsert}
|
||||
attributes/redact:
|
||||
actions:
|
||||
- {key: http.request.header.authorization, action: delete}
|
||||
- {key: http.request.header.cookie, action: delete}
|
||||
- {key: http.response.header.set-cookie, action: delete}
|
||||
- {key: url.query, action: delete}
|
||||
- {key: url.full, action: delete}
|
||||
- {key: http.target, action: delete}
|
||||
- {key: http.request.body, action: delete}
|
||||
- {key: db.statement, action: delete}
|
||||
- {key: db.query.text, action: delete}
|
||||
- {key: enduser.id, action: delete}
|
||||
- {key: user.phone, action: delete}
|
||||
- {key: user.email, action: delete}
|
||||
- {key: messaging.message.body, action: delete}
|
||||
- {key: aws.s3.key, action: delete}
|
||||
- {key: s3.object.key, action: delete}
|
||||
filter/noise:
|
||||
error_mode: ignore
|
||||
traces:
|
||||
span:
|
||||
- 'attributes["http.route"] == "/health/live"'
|
||||
- 'attributes["http.route"] == "/nginx-health/live"'
|
||||
tail_sampling:
|
||||
decision_wait: 10s
|
||||
num_traces: 10000
|
||||
expected_new_traces_per_sec: 50
|
||||
policies:
|
||||
- name: errors
|
||||
type: status_code
|
||||
status_code: {status_codes: [ERROR]}
|
||||
- name: slow
|
||||
type: latency
|
||||
latency: {threshold_ms: 2000}
|
||||
- name: successful-sample
|
||||
type: probabilistic
|
||||
probabilistic: {sampling_percentage: 10}
|
||||
batch:
|
||||
timeout: 5s
|
||||
send_batch_size: 1024
|
||||
send_batch_max_size: 2048
|
||||
|
||||
exporters:
|
||||
otlp/remote:
|
||||
endpoint: "${env:OTEL_REMOTE_ENDPOINT}"
|
||||
headers:
|
||||
authorization: ${file:/run/secrets/otel_remote_auth_header}
|
||||
tls:
|
||||
insecure: "${env:OTEL_REMOTE_TLS_INSECURE}"
|
||||
sending_queue:
|
||||
enabled: true
|
||||
num_consumers: 4
|
||||
queue_size: 10000
|
||||
storage: file_storage
|
||||
retry_on_failure:
|
||||
enabled: true
|
||||
initial_interval: 5s
|
||||
max_interval: 30s
|
||||
max_elapsed_time: 0s
|
||||
|
||||
service:
|
||||
extensions: [health_check, file_storage]
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, resource/common, attributes/redact, filter/noise, tail_sampling, batch]
|
||||
exporters: [otlp/remote]
|
||||
metrics:
|
||||
receivers: [otlp, prometheus]
|
||||
processors: [memory_limiter, resource/common, attributes/redact, batch]
|
||||
exporters: [otlp/remote]
|
||||
logs:
|
||||
receivers: [otlp]
|
||||
processors: [memory_limiter, resource/common, attributes/redact, batch]
|
||||
exporters: [otlp/remote]
|
||||
telemetry:
|
||||
metrics:
|
||||
address: 0.0.0.0:8888
|
||||
level: normal
|
||||
Reference in New Issue
Block a user