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

Commit b381701

Browse files
authored
Announce that legacy metric names are deprecated, will be turned off by default in Synapse v1.71.0 and removed altogether in Synapse v1.73.0. (#14024)
1 parent 4cb0f5a commit b381701

File tree

5 files changed

+64
-27
lines changed

5 files changed

+64
-27
lines changed

changelog.d/14024.removal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Announce that legacy metric names are deprecated, will be turned off by default in Synapse v1.71.0 and removed altogether in Synapse v1.73.0. See the upgrade notes for more information.

docs/metrics-howto.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ Synapse 1.2 updates the Prometheus metrics to match the naming
135135
convention of the upstream `prometheus_client`. The old names are
136136
considered deprecated and will be removed in a future version of
137137
Synapse.
138+
**The old names will be disabled by default in Synapse v1.71.0 and removed
139+
altogether in Synapse v1.73.0.**
138140

139141
| New Name | Old Name |
140142
| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------- |
@@ -146,6 +148,13 @@ Synapse.
146148
| synapse_federation_client_events_processed_total | synapse_federation_client_events_processed |
147149
| synapse_event_processing_loop_count_total | synapse_event_processing_loop_count |
148150
| synapse_event_processing_loop_room_count_total | synapse_event_processing_loop_room_count |
151+
| synapse_util_caches_cache_hits | synapse_util_caches_cache:hits |
152+
| synapse_util_caches_cache_size | synapse_util_caches_cache:size |
153+
| synapse_util_caches_cache_evicted_size | synapse_util_caches_cache:evicted_size |
154+
| synapse_util_caches_cache | synapse_util_caches_cache:total |
155+
| synapse_util_caches_response_cache_size | synapse_util_caches_response_cache:size |
156+
| synapse_util_caches_response_cache_hits | synapse_util_caches_response_cache:hits |
157+
| synapse_util_caches_response_cache_evicted_size | synapse_util_caches_response_cache:evicted_size |
149158
| synapse_util_metrics_block_count_total | synapse_util_metrics_block_count |
150159
| synapse_util_metrics_block_time_seconds_total | synapse_util_metrics_block_time_seconds |
151160
| synapse_util_metrics_block_ru_utime_seconds_total | synapse_util_metrics_block_ru_utime_seconds |
@@ -261,7 +270,7 @@ Standard Metric Names
261270

262271
As of synapse version 0.18.2, the format of the process-wide metrics has
263272
been changed to fit prometheus standard naming conventions. Additionally
264-
the units have been changed to seconds, from miliseconds.
273+
the units have been changed to seconds, from milliseconds.
265274

266275
| New name | Old name |
267276
| ---------------------------------------- | --------------------------------- |

docs/upgrade.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,34 @@ vice versa.
100100
Once all workers are upgraded to v1.69 (or downgraded to v1.68), receipts
101101
replication will resume as normal.
102102
103+
104+
## Deprecation of legacy Prometheus metric names
105+
106+
In current versions of Synapse, some Prometheus metrics are emitted under two different names,
107+
with one of the names being older but non-compliant with OpenMetrics and Prometheus conventions
108+
and one of the names being newer but compliant.
109+
110+
Synapse v1.71.0 will turn the old metric names off *by default*.
111+
For administrators that still rely on them and have not had chance to update their
112+
uses of the metrics, it's possible to specify `enable_legacy_metrics: true` in
113+
the configuration to re-enable them temporarily.
114+
115+
Synapse v1.73.0 will **remove legacy metric names altogether** and it will no longer
116+
be possible to re-enable them.
117+
118+
The Grafana dashboard, Prometheus recording rules and Prometheus Consoles included
119+
in the `contrib` directory in the Synapse repository have been updated to no longer
120+
rely on the legacy names. These can be used on a current version of Synapse
121+
because current versions of Synapse emit both old and new names.
122+
123+
You may need to update your alerting rules or any other rules that depend on
124+
the names of Prometheus metrics.
125+
If you want to test your changes before legacy names are disabled by default,
126+
you may specify `enable_legacy_metrics: false` in your homeserver configuration.
127+
128+
A list of affected metrics is available on the [Metrics How-to page](https://matrix-org.github.io/synapse/v1.69/metrics-howto.html?highlight=metrics%20deprecated#renaming-of-metrics--deprecation-of-old-names-in-12).
129+
130+
103131
# Upgrading to v1.68.0
104132

105133
Two changes announced in the upgrade notes for v1.67.0 have now landed in v1.68.0.

docs/usage/configuration/config_documentation.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,6 +2436,31 @@ Example configuration:
24362436
enable_metrics: true
24372437
```
24382438
---
2439+
### `enable_legacy_metrics`
2440+
2441+
Set to `true` to publish both legacy and non-legacy Prometheus metric names,
2442+
or to `false` to only publish non-legacy Prometheus metric names.
2443+
Defaults to `true`. Has no effect if `enable_metrics` is `false`.
2444+
**In Synapse v1.71.0, this will default to `false` before being removed in Synapse v1.73.0.**
2445+
2446+
Legacy metric names include:
2447+
- metrics containing colons in the name, such as `synapse_util_caches_response_cache:hits`, because colons are supposed to be reserved for user-defined recording rules;
2448+
- counters that don't end with the `_total` suffix, such as `synapse_federation_client_sent_edus`, therefore not adhering to the OpenMetrics standard.
2449+
2450+
These legacy metric names are unconventional and not compliant with OpenMetrics standards.
2451+
They are included for backwards compatibility.
2452+
2453+
Example configuration:
2454+
```yaml
2455+
enable_legacy_metrics: false
2456+
```
2457+
2458+
See https://github.com/matrix-org/synapse/issues/11106 for context.
2459+
2460+
*Since v1.67.0.*
2461+
2462+
**Will be removed in v1.73.0.**
2463+
---
24392464
### `sentry`
24402465

24412466
Use this option to enable sentry integration. Provide the DSN assigned to you by sentry

synapse/config/metrics.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,6 @@ class MetricsConfig(Config):
4343
def read_config(self, config: JsonDict, **kwargs: Any) -> None:
4444
self.enable_metrics = config.get("enable_metrics", False)
4545

46-
"""
47-
### `enable_legacy_metrics` (experimental)
48-
49-
**Experimental: this option may be removed or have its behaviour
50-
changed at any time, with no notice.**
51-
52-
Set to `true` to publish both legacy and non-legacy Prometheus metric names,
53-
or to `false` to only publish non-legacy Prometheus metric names.
54-
Defaults to `true`. Has no effect if `enable_metrics` is `false`.
55-
56-
Legacy metric names include:
57-
- metrics containing colons in the name, such as `synapse_util_caches_response_cache:hits`, because colons are supposed to be reserved for user-defined recording rules;
58-
- counters that don't end with the `_total` suffix, such as `synapse_federation_client_sent_edus`, therefore not adhering to the OpenMetrics standard.
59-
60-
These legacy metric names are unconventional and not compliant with OpenMetrics standards.
61-
They are included for backwards compatibility.
62-
63-
Example configuration:
64-
```yaml
65-
enable_legacy_metrics: false
66-
```
67-
68-
See https://github.com/matrix-org/synapse/issues/11106 for context.
69-
70-
*Since v1.67.0.*
71-
"""
7246
self.enable_legacy_metrics = config.get("enable_legacy_metrics", True)
7347

7448
self.report_stats = config.get("report_stats", None)

0 commit comments

Comments
 (0)