add otel collector to nginx

This commit is contained in:
Simon Larsen 2023-10-09 19:18:46 +01:00
parent 60b1f3bcc5
commit 591c89a320
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE
5 changed files with 40 additions and 3 deletions

View File

@ -57,7 +57,7 @@ upstream notification {
}
upstream otel-collector {
server ${SERVER_NOTIFICATION_HOSTNAME}:${NOTIFICATION_PORT} weight=10 max_fails=3 fail_timeout=30s;
server ${OTEL_COLLECTOR_HOSTNAME}:${OTEL_COLLECTOR_PORT} weight=10 max_fails=3 fail_timeout=30s;
}
server {
@ -212,6 +212,19 @@ server {
proxy_pass http://accounts;
}
location /otel-collector {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://otel-collector;
}
location /notification {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;

View File

@ -1 +1,3 @@
FROM otel/opentelemetry-collector:latest
FROM otel/opentelemetry-collector-contrib:latest
COPY ./OTelCollector/config.yaml /etc/otelcol-contrib/config.yaml

View File

View File

@ -117,6 +117,7 @@ ACCOUNTS_PORT=3003
STATUS_PAGE_PORT=3105
DASHBOARD_PORT=3009
ADMIN_DASHBOARD_PORT=3158
OTEL_COLLECTOR_PORT=4317
# If USE_INTERNAL_SMTP is true then you need to fill these values.

View File

@ -354,7 +354,28 @@ services:
- postgres
- notification
otel-collector:
networks:
- oneuptime
restart: always
ports:
- 1888:1888 # pprof extension
- 8888:8888 # Prometheus metrics exposed by the collector
- 8889:8889 # Prometheus exporter metrics
- 13133:13133 # health_check extension
- 4317:4317 # OTLP gRPC receiver
- 4318:4318 # OTLP http receiver
- 55679:55679 # zpages extension
depends_on:
- redis
- postgres
- notification
links:
- redis
- postgres
- notification
ingestor:
networks: