rycus86 / prometheus_flask_exporter

Prometheus exporter for Flask applications
https://pypi.python.org/pypi/prometheus-flask-exporter
MIT License
642 stars 162 forks source link

Prometheus Client 0.1.4.1 has reverted to choose_encoder over choose_formatter #140

Closed rhymes closed 2 years ago

rhymes commented 2 years ago

Apparently https://github.com/prometheus/client_python/pull/796 went back from:

from prometheus_client.exposition import choose_formatter

to

from prometheus_client.exposition import choose_encoder

I wondered if you'd be interested in a PR which swaps the import orders in here:

https://github.com/rycus86/prometheus_flask_exporter/blob/e1aac467124686ad5bd07e3de784b35296777b13/prometheus_flask_exporter/__init__.py#L15-L20

and keeps choose_encoder as the default name

rycus86 commented 2 years ago

Hm, interested in what's the reason for that suggestion? I'd have thought it's better to try the latest / more likely import first, and fall back to the other one in case you have that specific version?

rhymes commented 2 years ago

@rycus86 omg you're right, for some reason I read the first block as choose_formatter and not choose_encoder

Too many renames :D

Thanks for taking the time and sorry for the mishap!

rycus86 commented 2 years ago

No problem at all! :) I was curious if I was missing something. 😅