10 #include "prometheus/collectable.h"
11 #include "prometheus/detail/pull_export.h"
14 struct CivetCallbacks
;
16 namespace prometheus
{
22 class PROMETHEUS_CPP_PULL_EXPORT Exposer
{
24 explicit Exposer(const std::string
& bind_address
,
25 const std::size_t num_threads
= 2,
26 const CivetCallbacks
* callbacks
= nullptr);
27 explicit Exposer(std::vector
<std::string
> options
,
28 const CivetCallbacks
* callbacks
= nullptr);
31 Exposer(const Exposer
&) = delete;
32 Exposer(Exposer
&&) = delete;
33 Exposer
& operator=(const Exposer
&) = delete;
34 Exposer
& operator=(Exposer
&&) = delete;
36 void RegisterCollectable(const std::weak_ptr
<Collectable
>& collectable
,
37 const std::string
& uri
= std::string("/metrics"));
40 std::function
<bool(const std::string
&, const std::string
&)> authCB
,
41 const std::string
& realm
= "Prometheus-cpp Exporter",
42 const std::string
& uri
= std::string("/metrics"));
44 void RemoveCollectable(const std::weak_ptr
<Collectable
>& collectable
,
45 const std::string
& uri
= std::string("/metrics"));
47 std::vector
<int> GetListeningPorts() const;
50 detail::Endpoint
& GetEndpointForUri(const std::string
& uri
);
52 std::unique_ptr
<CivetServer
> server_
;
53 std::vector
<std::unique_ptr
<detail::Endpoint
>> endpoints_
;
57 } // namespace prometheus