This repository was archived by the owner on Apr 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 12
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
+ try :
16
+ from importlib import metadata
17
+ except ImportError :
18
+ import importlib_metadata as metadata # type: ignore[no-redef]
15
19
from unittest .mock import Mock , patch
16
20
21
+ from pkg_resources import parse_version
22
+
17
23
from synapse .app ._base import _set_prometheus_client_use_created_metrics
18
24
from synapse .metrics import REGISTRY , InFlightGauge , generate_latest
19
25
from synapse .util .caches .deferred_cache import DeferredCache
@@ -167,6 +173,9 @@ def test_cache_metric(self):
167
173
168
174
169
175
class PrometheusMetricsHackTestCase (unittest .HomeserverTestCase ):
176
+ if parse_version (metadata .version ("prometheus_client" )) < parse_version ("0.14.0" ):
177
+ skip = "prometheus-client too old"
178
+
170
179
def test_created_metrics_disabled (self ) -> None :
171
180
"""
172
181
Tests that a brittle hack, to disable `_created` metrics, works.
You can’t perform that action at this time.
0 commit comments