Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Make Jaeger fully configurable #5694

Merged
merged 7 commits into from
Jul 23, 2019
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
1 change: 1 addition & 0 deletions changelog.d/5694.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make Jaeger fully configurable.
16 changes: 16 additions & 0 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1430,3 +1430,19 @@ opentracing:
#
#homeserver_whitelist:
# - ".*"

# Jaeger can be configured to sample traces at different rates.
# All configuration options provided by Jaeger can be set here.
# Jaeger's configuration mostly related to trace sampling which
# is documented here:
# https://www.jaegertracing.io/docs/1.13/sampling/.
#
#jaeger_config:
# sampler:
# type: const
# param: 1

# Logging whether spans were started and reported
#
# logging:
# false
22 changes: 22 additions & 0 deletions synapse/config/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ def read_config(self, config, **kwargs):
opentracing_config = {}

self.opentracer_enabled = opentracing_config.get("enabled", False)

self.jaeger_config = opentracing_config.get(
"jaeger_config",
{"sampler": {"type": "const", "param": 1}, "logging": False},
)

if not self.opentracer_enabled:
return

Expand Down Expand Up @@ -56,4 +62,20 @@ def generate_config_section(cls, **kwargs):
#
#homeserver_whitelist:
# - ".*"

# Jaeger can be configured to sample traces at different rates.
# All configuration options provided by Jaeger can be set here.
# Jaeger's configuration mostly related to trace sampling which
# is documented here:
# https://www.jaegertracing.io/docs/1.13/sampling/.
#
#jaeger_config:
# sampler:
# type: const
# param: 1

# Logging whether spans were started and reported
#
# logging:
# false
"""
11 changes: 7 additions & 4 deletions synapse/logging/opentracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,16 @@ def init_tracer(config):
# Include the worker name
name = config.worker_name if config.worker_name else "master"

# Pull out the jaeger config if it was given. Otherwise set it to something sensible.
# See https://github.com/jaegertracing/jaeger-client-python/blob/master/jaeger_client/config.py

set_homeserver_whitelist(config.opentracer_whitelist)
jaeger_config = JaegerConfig(
config={"sampler": {"type": "const", "param": 1}, "logging": True},

JaegerConfig(
config=config.jaeger_config,
service_name="{} {}".format(config.server_name, name),
scope_manager=LogContextScopeManager(config),
)
jaeger_config.initialize_tracer()
).initialize_tracer()

# Set up tags to be opentracing's tags
global tags
Expand Down