File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -359,6 +359,23 @@ jobs:
359359
360360 - run : cargo test
361361
362+ otlp :
363+ if : ${{ !failure() && !cancelled() }}
364+ runs-on : ubuntu-latest
365+
366+ steps :
367+ - name : Run actions/checkout@v4 for synapse
368+ uses : actions/checkout@v4
369+ with :
370+ path : synapse
371+ - run : |
372+ set -e
373+ DOCKER_BUILDKIT=1 sudo docker build -t famedly/synapse -f docker/Dockerfile .
374+ cd otlp-test
375+ success() { [ -s out/traces.json ] && [ -s out/logs.json ]; }
376+ (until success; do sleep 1; done && sudo docker compose down >/dev/null 2>&1) &
377+ sudo timeout 30 docker compose up && success
378+
362379 # a job which marks all the other jobs as complete, thus allowing PRs to be merged.
363380 tests-done :
364381 if : ${{ always() }}
Original file line number Diff line number Diff line change @@ -191,3 +191,9 @@ trusted_key_servers:
191191
192192password_config :
193193 enabled : true
194+
195+ {% if OTLP_BACKEND %}
196+ opentracing :
197+ enabled : true
198+ backend : otlp
199+ {% endif %}
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ handlers:
4343 # Messages will not be delayed for longer than this time.
4444 # Default value: 5 seconds
4545 period: 5
46+ {% elif OTLP_BACKEND %}
47+ otlp:
48+ class: synapse.logging.handlers.OtlpHandler
4649{% endif %}
4750
4851 console:
8487
8588{% if LOG_FILE_PATH %}
8689 handlers: [console, buffer]
90+ {% elif OTLP_BACKEND %}
91+ handlers: [console, otlp]
8792{% else %}
8893 handlers: [console]
8994{% endif %}
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ OpenTracing is a semi-standard being adopted by a number of distributed
66tracing platforms. It is a common api for facilitating vendor-agnostic
77tracing instrumentation. That is, we can use the OpenTracing api and
88select one of a number of tracer implementations to do the heavy lifting
9- in the background. Our current selected implementation is Jaeger.
9+ in the background. Our current implementations are Jaeger (default) and
10+ OpenTelemetry.
1011
1112OpenTracing is a tool which gives an insight into the causal
1213relationship of work done in and between servers. The servers each track
@@ -74,6 +75,14 @@ opentracing:
7475 - " *.myotherhomeservers.com"
7576` ` `
7677
78+ To use OpenTelemetry instead of Jaeger as the ` backend`:
79+
80+ ` ` ` yaml
81+ opentracing:
82+ enabled: true
83+ backend: otlp
84+ ` ` `
85+
7786# # Homeserver whitelisting
7887
7988The homeserver whitelist is configured using regular expressions. A list
Original file line number Diff line number Diff line change @@ -56,6 +56,12 @@ handlers:
5656 class : logging.StreamHandler
5757 formatter : precise
5858
59+ # A commented-out OtlpHandler based on opentelemetry-sdk that reads
60+ # its configuration from the common `OTLP_` environment variables:
61+ # Requires the extra "opentelemetry-log-handler".
62+ # otlp:
63+ # class: synapse.logging.handlers.OtlpHandler
64+
5965loggers :
6066 synapse.storage.SQL :
6167 # beware: increasing this to DEBUG will make synapse log sensitive
7076 #
7177 # Replace "buffer" with "console" to log to stderr instead.
7278 #
79+ # Add or set the handler to "otlp" after enabling it in the "handlers" section.
80+ #
7381 handlers : [buffer]
7482
7583disable_existing_loggers : false
Original file line number Diff line number Diff line change 1+ services :
2+
3+ init :
4+ image : famedly/synapse
5+ user : root
6+ command : migrate_config
7+ volumes :
8+ - ./synapse-data:/data
9+ environment :
10+ - SYNAPSE_SERVER_NAME=example.com
11+ - SYNAPSE_REPORT_STATS=no
12+ - SYNAPSE_NO_TLS=1
13+ - OTLP_BACKEND=1
14+
15+ synapse :
16+ image : famedly/synapse
17+ user : root
18+ volumes :
19+ - ./synapse-data:/data
20+ environment :
21+ - OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
22+ depends_on :
23+ - init
24+ - otel-collector
25+
26+ otel-collector :
27+ image : otel/opentelemetry-collector:0.86.0
28+ user : " 0"
29+ command : [ "--config=/etc/otel-collector.yaml" ]
30+ volumes :
31+ - ./otel-collector.yaml:/etc/otel-collector.yaml
32+ - ./out:/etc/out
Original file line number Diff line number Diff line change 1+ receivers :
2+ otlp :
3+ protocols :
4+ grpc :
5+ http :
6+ exporters :
7+ file/traces :
8+ path : /etc/out/traces.json
9+ file/logs :
10+ path : /etc/out/logs.json
11+ service :
12+ pipelines :
13+ traces :
14+ receivers : [otlp]
15+ exporters : [file/traces]
16+ logs :
17+ receivers : [otlp]
18+ exporters : [file/logs]
You can’t perform that action at this time.
0 commit comments