diff --git a/prometheus_client/exposition.py b/prometheus_client/exposition.py index 4a988932..c592af14 100644 --- a/prometheus_client/exposition.py +++ b/prometheus_client/exposition.py @@ -15,7 +15,6 @@ BaseHandler, build_opener, HTTPHandler, HTTPRedirectHandler, HTTPSHandler, Request, ) -import warnings from wsgiref.simple_server import make_server, WSGIRequestHandler, WSGIServer from .openmetrics import exposition as openmetrics @@ -249,15 +248,6 @@ def choose_encoder(accept_header: str) -> Tuple[Callable[[CollectorRegistry], by return generate_latest, CONTENT_TYPE_LATEST -def choose_formatter(accept_header: str) -> Tuple[Callable[[CollectorRegistry], bytes], str]: - warnings.warn( - "choose_formatter is deprecated and will be removed in 0.15.0, please use choose_encoder instead", - DeprecationWarning, - stacklevel=2 - ) - return choose_encoder(accept_header) - - def gzip_accepted(accept_encoding_header: str) -> bool: accept_encoding_header = accept_encoding_header or '' for accepted in accept_encoding_header.split(','): diff --git a/tests/test_exposition.py b/tests/test_exposition.py index 7509232a..54bdaa98 100644 --- a/tests/test_exposition.py +++ b/tests/test_exposition.py @@ -3,7 +3,6 @@ import threading import time import unittest -import warnings import pytest @@ -14,8 +13,8 @@ ) from prometheus_client.core import GaugeHistogramMetricFamily, Timestamp from prometheus_client.exposition import ( - basic_auth_handler, choose_encoder, choose_formatter, default_handler, - MetricsHandler, passthrough_redirect_handler, tls_auth_handler, + basic_auth_handler, choose_encoder, default_handler, MetricsHandler, + passthrough_redirect_handler, tls_auth_handler, ) import prometheus_client.openmetrics.exposition as openmetrics @@ -480,13 +479,5 @@ def test_choose_encoder(): assert choose_encoder(openmetrics.CONTENT_TYPE_LATEST) == (openmetrics.generate_latest, openmetrics.CONTENT_TYPE_LATEST) -def test_choose_formatter(): - with warnings.catch_warnings(record=True) as w: - assert choose_formatter('') == (generate_latest, CONTENT_TYPE_LATEST) - assert len(w) == 1 - assert issubclass(w[-1].category, DeprecationWarning) - assert "choose_formatter is deprecated" in str(w[-1].message) - - if __name__ == '__main__': unittest.main()