|
18 | 18 |
|
19 | 19 | class TracerConfig(Config): |
20 | 20 | def read_config(self, config, **kwargs): |
21 | | - self.tracer_config = config.get("opentracing") |
| 21 | + opentracing_config = config.get("opentracing") |
| 22 | + if opentracing_config is None: |
| 23 | + opentracing_config = {} |
22 | 24 |
|
23 | | - self.tracer_config = config.get("opentracing", {"tracer_enabled": False}) |
| 25 | + self.opentracer_enabled = opentracing_config.get("enabled", False) |
| 26 | + if not self.opentracer_enabled: |
| 27 | + return |
24 | 28 |
|
25 | | - if self.tracer_config.get("tracer_enabled", False): |
26 | | - # The tracer is enabled so sanitize the config |
27 | | - # If no whitelists are given |
28 | | - self.tracer_config.setdefault("homeserver_whitelist", []) |
| 29 | + # The tracer is enabled so sanitize the config |
29 | 30 |
|
30 | | - if not isinstance(self.tracer_config.get("homeserver_whitelist"), list): |
31 | | - raise ConfigError("Tracer homesererver_whitelist config is malformed") |
| 31 | + self.opentracer_whitelist = opentracing_config.get("homeserver_whitelist", []) |
| 32 | + if not isinstance(self.opentracer_whitelist, list): |
| 33 | + raise ConfigError("Tracer homeserver_whitelist config is malformed") |
32 | 34 |
|
33 | 35 | def generate_config_section(cls, **kwargs): |
34 | 36 | return """\ |
35 | 37 | ## Opentracing ## |
36 | | - # These settings enable opentracing which implements distributed tracing |
37 | | - # This allows you to observe the causal chain of events across servers |
38 | | - # including requests, key lookups etc. across any server running |
39 | | - # synapse or any other other services which supports opentracing. |
40 | | - # (specifically those implemented with jaeger) |
41 | | -
|
42 | | - #opentracing: |
43 | | - # # Enable / disable tracer |
44 | | - # tracer_enabled: false |
45 | | - # # The list of homeservers we wish to expose our current traces to. |
46 | | - # # The list is a list of regexes which are matched against the |
47 | | - # # servername of the homeserver |
48 | | - # homeserver_whitelist: |
49 | | - # - ".*" |
| 38 | +
|
| 39 | + # These settings enable opentracing, which implements distributed tracing. |
| 40 | + # This allows you to observe the causal chains of events across servers |
| 41 | + # including requests, key lookups etc., across any server running |
| 42 | + # synapse or any other other services which supports opentracing |
| 43 | + # (specifically those implemented with Jaeger). |
| 44 | + # |
| 45 | + opentracing: |
| 46 | + # tracing is disabled by default. Uncomment the following line to enable it. |
| 47 | + # |
| 48 | + #enabled: true |
| 49 | +
|
| 50 | + # The list of homeservers we wish to send and receive span contexts and span baggage. |
| 51 | + # |
| 52 | + # Though it's mostly safe to send and receive span contexts to and from |
| 53 | + # untrusted users since span contexts are usually opaque ids it can lead to |
| 54 | + # two problems, namely: |
| 55 | + # - If the span context is marked as sampled by the sending homeserver the receiver will |
| 56 | + # sample it. Therefore two homeservers with wildly disparaging sampling policies |
| 57 | + # could incur higher sampling counts than intended. |
| 58 | + # - Span baggage can be arbitrary data. For safety this has been disabled in synapse |
| 59 | + # but that doesn't prevent another server sending you baggage which will be logged |
| 60 | + # to opentracing logs. |
| 61 | + # |
| 62 | + # This a list of regexes which are matched against the server_name of the |
| 63 | + # homeserver. |
| 64 | + # |
| 65 | + # By defult, it is empty, so no servers are matched. |
| 66 | + # |
| 67 | + #homeserver_whitelist: |
| 68 | + # - ".*" |
50 | 69 | """ |
0 commit comments