Library: Prometheus
Package: HTTP
Header: Poco/Prometheus/MetricsServer.h
Description
A basic HTTP server for handling Prometheus metrics scraping requests, based on Poco::Net::HTTPServer.
Member Summary
Member Functions: defaultParams, start, stop
Constructors
MetricsServer
MetricsServer(
Poco::UInt16 port = DEFAULT_PORT,
const std::string & path = DEFAULT_PATH
);
Creates a HTTPServer for serving metrics using the default Registry, listening on the given port number and the given path.
MetricsServer
MetricsServer(
const Registry & registry,
Poco::UInt16 port = DEFAULT_PORT,
const std::string & path = DEFAULT_PATH
);
Creates a HTTPServer for serving metrics using the given Registry, listening on the given port number and the given path.
MetricsServer
MetricsServer(
const Registry & registry,
Poco::Net::ServerSocket & socket,
Poco::Net::HTTPServerParams::Ptr pServerParams = defaultParams (),
const std::string & path = DEFAULT_PATH
);
Creates a HTTPServer for serving metrics using the given Registry, listening on the server socket (which can be a properly configured Poco::Net::SecureServerSocket to enable HTTPS), and the given path.
Destructor
~MetricsServer
~MetricsServer() = default;
Destroys the HTTPServer.
Member Functions
start
void start();
Starts the underlying Poco::Net::HTTPServer.
stop
void stop();
Stops the underlying Poco::Net::HTTPServer.
defaultParams
static Poco::Net::HTTPServerParams::Ptr defaultParams();
Variables
DEFAULT_PATH
static const std::string DEFAULT_PATH;
"/metrics"
DEFAULT_PORT
static const Poco::UInt16 DEFAULT_PORT;
9100