Merge branch 'main' into livekit-experiment
This commit is contained in:
18
config/otel_dev/README.md
Normal file
18
config/otel_dev/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# OpenTelemetry Collector for development
|
||||
|
||||
This directory contains a docker compose file that starts a jaeger all-in-one instance
|
||||
with an in-memory database, along with a standalone OpenTelemetry collector that forwards
|
||||
traces into the jaeger. Jaeger has a built-in OpenTelemetry collector, but it can't be
|
||||
configured to send CORS headers so can't be used from a browser. This sets the config on
|
||||
the collector to send CORS headers.
|
||||
|
||||
This also adds an nginx to add CORS headers to the jaeger query endpoint, such that it can
|
||||
be used from webapps like stalk (https://deniz.co/stalk/). The CORS enabled endpoint is
|
||||
exposed on port 16687. To use stalk, you should simply be able to navigate to it and add
|
||||
http://127.0.0.1:16687/api as a data source.
|
||||
|
||||
(Yes, we could enable the OTLP collector in jaeger all-in-one and passed this through
|
||||
the nginx to enable CORS too, rather than running a separate collector. There's no reason
|
||||
it's done this way other than that I'd already set up the separate collector.)
|
||||
|
||||
Running `docker compose up` in this directory should be all you need.
|
||||
41
config/otel_dev/collector-gateway.yaml
Normal file
41
config/otel_dev/collector-gateway.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318
|
||||
cors:
|
||||
allowed_origins:
|
||||
# This can't be '*' because opentelemetry-js uses sendBeacon which always operates
|
||||
# in 'withCredentials' mode, which browsers don't allow with an allow-origin of '*'
|
||||
#- "https://pr976--element-call.netlify.app"
|
||||
- "http://*"
|
||||
allowed_headers:
|
||||
- "*"
|
||||
processors:
|
||||
batch:
|
||||
timeout: 1s
|
||||
resource:
|
||||
attributes:
|
||||
- key: test.key
|
||||
value: "test-value"
|
||||
action: insert
|
||||
exporters:
|
||||
logging:
|
||||
loglevel: info
|
||||
jaeger:
|
||||
endpoint: jaeger-all-in-one:14250
|
||||
tls:
|
||||
insecure: true
|
||||
extensions:
|
||||
health_check:
|
||||
pprof:
|
||||
endpoint: :1888
|
||||
zpages:
|
||||
endpoint: :55679
|
||||
service:
|
||||
extensions: [pprof, zpages, health_check]
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch, resource]
|
||||
exporters: [logging, jaeger]
|
||||
29
config/otel_dev/docker-compose.yaml
Normal file
29
config/otel_dev/docker-compose.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
version: "2"
|
||||
services:
|
||||
# Jaeger
|
||||
jaeger-all-in-one:
|
||||
image: jaegertracing/all-in-one:latest
|
||||
ports:
|
||||
- "16686:16686"
|
||||
- "14268"
|
||||
- "14250"
|
||||
# Collector
|
||||
collector-gateway:
|
||||
image: otel/opentelemetry-collector:latest
|
||||
volumes:
|
||||
- ./collector-gateway.yaml:/etc/collector-gateway.yaml
|
||||
command: ["--config=/etc/collector-gateway.yaml"]
|
||||
ports:
|
||||
- "1888:1888" # pprof extension
|
||||
- "13133:13133" # health_check extension
|
||||
- "4317:4317" # OTLP gRPC receiver
|
||||
- "4318:4318" # OTLP HTTP receiver
|
||||
- "55670:55679" # zpages extension
|
||||
depends_on:
|
||||
- jaeger-all-in-one
|
||||
nginx:
|
||||
image: nginxinc/nginx-unprivileged:latest
|
||||
volumes:
|
||||
- ./nginx_otel.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
ports:
|
||||
- "16687:8080"
|
||||
16
config/otel_dev/nginx_otel.conf
Normal file
16
config/otel_dev/nginx_otel.conf
Normal file
@@ -0,0 +1,16 @@
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
proxy_pass http://jaeger-all-in-one:16686/;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
|
||||
if ($request_method = OPTIONS) {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Content-Type text/plain;
|
||||
add_header Content-Length 0;
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user