PrometheusBuilder::install panics without a thread-local runtime #122
Labels
C-exporter
Component: exporters such as Prometheus, TCP, etc.
E-simple
Effort: simple.
T-bug
Type: bug.
PrometheusBuilder::install
callsPrometheusBuilder::build_with_exporter
to configure the exporter, then creates atokio
runtime and uses it to run the exporter.In #92
PrometheusBuilder::build
(nowbuild_with_exporter
) was refactored to callServer::try_bind
before starting the server. This means thathyper
operations happen outside theexporter
future, whereas previously allhyper
operations happened insideRuntime::block_on
.The problem with this is that
Server::try_bind
eventually callstokio::net::tcp::TcpListener::from_std
, which panics if thread-local runtime is not set:I believe the solution is to create the runtime first, and then enter its context when building the exporter:
The text was updated successfully, but these errors were encountered: