Update to v1.52.0

This commit is contained in:
Kai A. Hiller 2022-02-08 15:24:49 +01:00
parent 49740b547f
commit 653ced802e
2 changed files with 82 additions and 3 deletions

View file

@ -0,0 +1,74 @@
From b5a1489e0c00701aee43ca207cdde093726890e4 Mon Sep 17 00:00:00 2001
From: reivilibre <oliverw@matrix.org>
Date: Wed, 2 Feb 2022 16:51:00 +0000
Subject: [PATCH 2/2] Fix type errors introduced by new annotations in the
Prometheus Client library. (#11832)
Co-authored-by: David Robertson <davidr@element.io>
---
changelog.d/11832.misc | 1 +
synapse/metrics/__init__.py | 10 +++++++++-
synapse/python_dependencies.py | 3 +--
3 files changed, 11 insertions(+), 3 deletions(-)
create mode 100644 changelog.d/11832.misc
diff --git a/changelog.d/11832.misc b/changelog.d/11832.misc
new file mode 100644
index 0000000000..5ff117d933
--- /dev/null
+++ b/changelog.d/11832.misc
@@ -0,0 +1 @@
+Fix type errors introduced by new annotations in the Prometheus Client library.
\ No newline at end of file
diff --git a/synapse/metrics/__init__.py b/synapse/metrics/__init__.py
index 9e6c1b2f3b..cca084c18c 100644
--- a/synapse/metrics/__init__.py
+++ b/synapse/metrics/__init__.py
@@ -30,6 +30,7 @@ from typing import (
Type,
TypeVar,
Union,
+ cast,
)
import attr
@@ -60,7 +61,7 @@ all_gauges: "Dict[str, Union[LaterGauge, InFlightGauge]]" = {}
HAVE_PROC_SELF_STAT = os.path.exists("/proc/self/stat")
-class RegistryProxy:
+class _RegistryProxy:
@staticmethod
def collect() -> Iterable[Metric]:
for metric in REGISTRY.collect():
@@ -68,6 +69,13 @@ class RegistryProxy:
yield metric
+# A little bit nasty, but collect() above is static so a Protocol doesn't work.
+# _RegistryProxy matches the signature of a CollectorRegistry instance enough
+# for it to be usable in the contexts in which we use it.
+# TODO Do something nicer about this.
+RegistryProxy = cast(CollectorRegistry, _RegistryProxy)
+
+
@attr.s(slots=True, hash=True, auto_attribs=True)
class LaterGauge:
diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py
index d25f6e18e3..c7cfa9ae87 100644
--- a/synapse/python_dependencies.py
+++ b/synapse/python_dependencies.py
@@ -76,8 +76,7 @@ REQUIREMENTS = [
"msgpack>=0.5.2",
"phonenumbers>=8.2.0",
# we use GaugeHistogramMetric, which was added in prom-client 0.4.0.
- # 0.13.0 has an incorrect type annotation, see #11832.
- "prometheus_client>=0.4.0,<0.13.0",
+ "prometheus_client>=0.4.0",
# we use `order`, which arrived in attrs 19.2.0.
# Note: 21.1.0 broke `/sync`, see #9936
"attrs>=19.2.0,!=21.1.0",
--
2.34.1

View file

@ -6,7 +6,7 @@
%{?python_enable_dependency_generator}
Name: matrix-%{srcname}
Version: 1.51.0
Version: 1.52.0
Release: 1%{?dist}
Summary: A Matrix reference homeserver written in Python using Twisted
License: ASL 2.0
@ -17,6 +17,7 @@ Source2: synapse.service
Source3: matrix-synapse.sysusers
# non-upstreamable patch to accept any version of python-cryptography, see RHBZ#1978949
Patch1: 0001-relax-cryptography-dependency-version-requirement.patch
Patch2: 0002-Fix-type-errors-introduced-by-new-annotations-in-the.patch
BuildArch: noarch
BuildRequires: python3-devel
@ -42,13 +43,13 @@ BuildRequires: python3-ijson
BuildRequires: python3-jinja2 >= 2.9
BuildRequires: python3-jsonschema
BuildRequires: python3-jwt
BuildRequires: python3-lxml >= 3.5.0
BuildRequires: python3-lxml
BuildRequires: python3-matrix-common
BuildRequires: python3-matrix-synapse-ldap3 >= 0.1
BuildRequires: python3-msgpack >= 0.5.2
BuildRequires: python3-netaddr >= 0.7.18
BuildRequires: python3-phonenumbers >= 8.2.0
BuildRequires: python3-pillow >= 4.3.0
BuildRequires: python3-pillow
BuildRequires: python3-prometheus_client
BuildRequires: python3-pyOpenSSL >= 16.0.0
BuildRequires: python3-pyasn1 >= 0.1.9
@ -139,6 +140,10 @@ PYTHONPATH=. trial-3 tests
%changelog
* Tue Feb 08 2022 Kai A. Hiller <V02460@gmail.com> - 1.52.0-1
- Update to v1.52.0
- Create synapse user and group declaratively
* Thu Jan 27 2022 Kai A. Hiller <V02460@gmail.com> - 1.51.0-1
- Update to v1.51.0