8000 Remove choose_formatter before 0.15.0 release · prometheus/client_python@3babf4b · GitHub
[go: up one dir, main page]

Skip to content

Commit 3babf4b

Browse files
committed
Remove choose_formatter before 0.15.0 release
The original choose_encoder function was accidentally renamed in 0.14.0 to choose_formatter. In 0.14.1 we left both functions but with choose_formatter marked deprecated and to be removed by 0.15.0. Signed-off-by: Chris Marchbanks <csmarchbanks@gmail.com>
1 parent 64328fb commit 3babf4b

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

prometheus_client/exposition.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
BaseHandler, build_opener, HTTPHandler, HTTPRedirectHandler, HTTPSHandler,
1616
Request,
1717
)
18-
import warnings
1918
from wsgiref.simple_server import make_server, WSGIRequestHandler, WSGIServer
2019

2120
from .openmetrics import exposition as openmetrics
@@ -249,15 +248,6 @@ def choose_encoder(accept_header: str) -> Tuple[Callable[[CollectorRegistry], by
249248
return generate_latest, CONTENT_TYPE_LATEST
250249

251250

252-
def choose_formatter(accept_header: str) -> Tuple[Callable[[CollectorRegistry], bytes], str]:
253-
warnings.warn(
254-
"choose_formatter is deprecated and will be removed in 0.15.0, please use choose_encoder instead",
255-
DeprecationWarning,
256-
stacklevel=2
257-
)
258-
return choose_encoder(accept_header)
259-
260-
261251
def gzip_accepted(accept_encoding_header: str) -> bool:
262252
accept_encoding_header = accept_encoding_header or ''
263253
for accepted in accept_encoding_header.split(','):

tests/test_exposition.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import threading
44
import time
55
import unittest
6-
import warnings
76

87
import pytest
98

@@ -14,8 +13,8 @@
1413
)
1514
from prometheus_client.core import GaugeHistogramMetricFamily, Timestamp
1615
from prometheus_client.exposition import (
17-
basic_auth_handler, choose_encoder, choose_formatter, default_handler,
18-
MetricsHandler, passthrough_redirect_handler, tls_auth_handler,
16+
basic_auth_handler, choose_encoder, default_handler, MetricsHandler,
17+
passthrough_redirect_handler, tls_auth_handler,
1918
)
2019
import prometheus_client.openmetrics.exposition as openmetrics
2120

@@ -480,13 +479,5 @@ def test_choose_encoder():
480479
assert choose_encoder(openmetrics.CONTENT_TYPE_LATEST) == (openmetrics.generate_latest, openmetrics.CONTENT_TYPE_LATEST)
481480

482481

483-
def test_choose_formatter():
484-
with warnings.catch_warnings(record=True) as w:
485-
assert choose_formatter('') == (generate_latest, CONTENT_TYPE_LATEST)
486-
assert len(w) == 1
487-
assert issubclass(w[-1].category, DeprecationWarning)
488-
assert "choose_formatter is deprecated" in str(w[-1].message)
489-
490-
491482
if __name__ == '__main__':
492483
unittest.main()

0 commit comments

Comments
 (0)
0