Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/famedly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,23 @@ jobs:

- run: cargo test

otlp:
if: ${{ !failure() && !cancelled() }}
runs-on: ubuntu-latest

steps:
- name: Run actions/checkout@v4 for synapse
uses: actions/checkout@v4
with:
path: synapse
- run: |
set -e
DOCKER_BUILDKIT=1 sudo docker build -t famedly/synapse -f docker/Dockerfile .
cd otlp-test
success() { [ -s out/traces.json ] && [ -s out/logs.json ]; }
(until success; do sleep 1; done && sudo docker compose down >/dev/null 2>&1) &
sudo timeout 30 docker compose up && success

# a job which marks all the other jobs as complete, thus allowing PRs to be merged.
tests-done:
if: ${{ always() }}
Expand Down
6 changes: 6 additions & 0 deletions docker/conf/homeserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,9 @@ trusted_key_servers:

password_config:
enabled: true

{% if OTLP_BACKEND %}
opentracing:
enabled: true
backend: otlp
{% endif %}
5 changes: 5 additions & 0 deletions docker/conf/log.config
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ handlers:
# Messages will not be delayed for longer than this time.
# Default value: 5 seconds
period: 5
{% elif OTLP_BACKEND %}
otlp:
class: synapse.logging.handlers.OtlpHandler
{% endif %}

console:
Expand Down Expand Up @@ -84,6 +87,8 @@ root:

{% if LOG_FILE_PATH %}
handlers: [console, buffer]
{% elif OTLP_BACKEND %}
handlers: [console, otlp]
{% else %}
handlers: [console]
{% endif %}
Expand Down
11 changes: 10 additions & 1 deletion docs/opentracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ OpenTracing is a semi-standard being adopted by a number of distributed
tracing platforms. It is a common api for facilitating vendor-agnostic
tracing instrumentation. That is, we can use the OpenTracing api and
select one of a number of tracer implementations to do the heavy lifting
in the background. Our current selected implementation is Jaeger.
in the background. Our current implementations are Jaeger (default) and
OpenTelemetry.

OpenTracing is a tool which gives an insight into the causal
relationship of work done in and between servers. The servers each track
Expand Down Expand Up @@ -74,6 +75,14 @@ opentracing:
- "*.myotherhomeservers.com"
```

To use OpenTelemetry instead of Jaeger as the `backend`:

```yaml
opentracing:
enabled: true
backend: otlp
```

## Homeserver whitelisting

The homeserver whitelist is configured using regular expressions. A list
Expand Down
8 changes: 8 additions & 0 deletions docs/sample_log_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ handlers:
class: logging.StreamHandler
formatter: precise

# A commented-out OtlpHandler based on opentelemetry-sdk that reads
# its configuration from the common `OTLP_` environment variables:
# Requires the extra "opentelemetry-log-handler".
#otlp:
# class: synapse.logging.handlers.OtlpHandler

loggers:
synapse.storage.SQL:
# beware: increasing this to DEBUG will make synapse log sensitive
Expand All @@ -70,6 +76,8 @@ root:
#
# Replace "buffer" with "console" to log to stderr instead.
#
# Add or set the handler to "otlp" after enabling it in the "handlers" section.
#
handlers: [buffer]

disable_existing_loggers: false
32 changes: 32 additions & 0 deletions otlp-test/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
services:

init:
image: famedly/synapse
user: root
command: migrate_config
volumes:
- ./synapse-data:/data
environment:
- SYNAPSE_SERVER_NAME=example.com
- SYNAPSE_REPORT_STATS=no
- SYNAPSE_NO_TLS=1
- OTLP_BACKEND=1

synapse:
image: famedly/synapse
user: root
volumes:
- ./synapse-data:/data
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
depends_on:
- init
- otel-collector

otel-collector:
image: otel/opentelemetry-collector:0.86.0
user: "0"
command: [ "--config=/etc/otel-collector.yaml" ]
volumes:
- ./otel-collector.yaml:/etc/otel-collector.yaml
- ./out:/etc/out
18 changes: 18 additions & 0 deletions otlp-test/otel-collector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
receivers:
otlp:
protocols:
grpc:
http:
exporters:
file/traces:
path: /etc/out/traces.json
file/logs:
path: /etc/out/logs.json
service:
pipelines:
traces:
receivers: [otlp]
exporters: [file/traces]
logs:
receivers: [otlp]
exporters: [file/logs]
Loading