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

Commit 526f84b

Browse files
authored
Fix Prometheus recording rules to not use legacy metric names. (#13718)
1 parent 1cc729c commit 526f84b

File tree

6 files changed

+22
-37
lines changed

6 files changed

+22
-37
lines changed

changelog.d/13718.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add experimental configuration option to allow disabling legacy Prometheus metric names.

contrib/prometheus/synapse-v1.rules

Lines changed: 0 additions & 21 deletions
This file was deleted.

contrib/prometheus/synapse-v2.rules

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ groups:
2020
expr: 'sum(synapse_http_server_request_count:by_method) by (servlet)'
2121

2222
- record: 'synapse_cache:hit_ratio_5m'
23-
expr: 'rate(synapse_util_caches_cache:hits[5m]) / rate(synapse_util_caches_cache:total[5m])'
23+
expr: 'rate(synapse_util_caches_cache_hits[5m]) / rate(synapse_util_caches_cache[5m])'
2424
- record: 'synapse_cache:hit_ratio_30s'
25-
expr: 'rate(synapse_util_caches_cache:hits[30s]) / rate(synapse_util_caches_cache:total[30s])'
25+
expr: 'rate(synapse_util_caches_cache_hits[30s]) / rate(synapse_util_caches_cache[30s])'
2626

2727
- record: 'synapse_federation_client_sent'
2828
labels:
2929
type: "EDU"
30-
expr: 'synapse_federation_client_sent_edus + 0'
30+
expr: 'synapse_federation_client_sent_edus_total + 0'
3131
- record: 'synapse_federation_client_sent'
3232
labels:
3333
type: "PDU"
34-
expr: 'synapse_federation_client_sent_pdu_destinations:count + 0'
34+
expr: 'synapse_federation_client_sent_pdu_destinations_count_total + 0'
3535
- record: 'synapse_federation_client_sent'
3636
labels:
3737
type: "Query"
@@ -40,11 +40,11 @@ groups:
4040
- record: 'synapse_federation_server_received'
4141
labels:
4242
type: "EDU"
43-
expr: 'synapse_federation_server_received_edus + 0'
43+
expr: 'synapse_federation_server_received_edus_total + 0'
4444
- record: 'synapse_federation_server_received'
4545
labels:
4646
type: "PDU"
47-
expr: 'synapse_federation_server_received_pdus + 0'
47+
expr: 'synapse_federation_server_received_pdus_total + 0'
4848
- record: 'synapse_federation_server_received'
4949
labels:
5050
type: "Query"
@@ -60,19 +60,19 @@ groups:
6060
expr: 'synapse_federation_transaction_queue_pending_pdus + 0'
6161

6262
- record: synapse_storage_events_persisted_by_source_type
63-
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep{origin_type="remote"})
63+
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep_total{origin_type="remote"})
6464
labels:
6565
type: remote
6666
- record: synapse_storage_events_persisted_by_source_type
67-
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep{origin_entity="*client*",origin_type="local"})
67+
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep_total{origin_entity="*client*",origin_type="local"})
6868
labels:
6969
type: local
7070
- record: synapse_storage_events_persisted_by_source_type
71-
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep{origin_entity!="*client*",origin_type="local"})
71+
expr: sum without(type, origin_type, origin_entity) (synapse_storage_events_persisted_events_sep_total{origin_entity!="*client*",origin_type="local"})
7272
labels:
7373
type: bridges
7474
- record: synapse_storage_events_persisted_by_event_type
75-
expr: sum without(origin_entity, origin_type) (synapse_storage_events_persisted_events_sep)
75+
expr: sum without(origin_entity, origin_type) (synapse_storage_events_persisted_events_sep_total)
7676
- record: synapse_storage_events_persisted_by_origin
77-
expr: sum without(type) (synapse_storage_events_persisted_events_sep)
77+
expr: sum without(type) (synapse_storage_events_persisted_events_sep_total)
7878

synapse/app/phone_stats_home.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
_stats_process: List[Tuple[int, "resource.struct_rusage"]] = []
3333

3434
# Gauges to expose monthly active user control metrics
35-
current_mau_gauge = Gauge("synapse_admin_mau:current", "Current MAU")
35+
current_mau_gauge = Gauge("synapse_admin_mau_current", "Current MAU")
3636
current_mau_by_service_gauge = Gauge(
3737
"synapse_admin_mau_current_mau_by_service",
3838
"Current MAU by service",
3939
["app_service"],
4040
)
41-
max_mau_gauge = Gauge("synapse_admin_mau:max", "MAU Limit")
41+
max_mau_gauge = Gauge("synapse_admin_mau_max", "MAU Limit")
4242
registered_reserved_users_mau_gauge = Gauge(
43-
"synapse_admin_mau:registered_reserved_users",
43+
"synapse_admin_mau_registered_reserved_users",
4444
"Registered users with reserved threepids",
4545
)
4646

synapse/federation/sender/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@
6262
logger = logging.getLogger(__name__)
6363

6464
sent_pdus_destination_dist_count = Counter(
65-
"synapse_federation_client_sent_pdu_destinations:count",
65+
"synapse_federation_client_sent_pdu_destinations_count",
6666
"Number of PDUs queued for sending to one or more destinations",
6767
)
6868

6969
sent_pdus_destination_dist_total = Counter(
70-
"synapse_federation_client_sent_pdu_destinations:total",
70+
"synapse_federation_client_sent_pdu_destinations",
7171
"Total number of PDUs queued for sending across all destinations",
7272
)
7373

synapse/metrics/_legacy_exposition.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ def sample_line(line: Sample, name: str) -> str:
9393
"synapse_util_caches_response_cache_hits": "synapse_util_caches_response_cache:hits",
9494
"synapse_util_caches_response_cache_evicted_size": "synapse_util_caches_response_cache:evicted_size",
9595
"synapse_util_caches_response_cache": "synapse_util_caches_response_cache:total",
96+
"synapse_federation_client_sent_pdu_destinations": "synapse_federation_client_sent_pdu_destinations:total",
97+
"synapse_federation_client_sent_pdu_destinations_count": "synapse_federation_client_sent_pdu_destinations:count",
98+
"synapse_admin_mau_current": "synapse_admin_mau:current",
99+
"synapse_admin_mau_max": "synapse_admin_mau:max",
100+
"synapse_admin_mau_registered_reserved_users": "synapse_admin_mau:registered_reserved_users",
96101
}
97102

98103

0 commit comments

Comments
 (0)