Bump docs

This commit is contained in:
Daniil Gentili 2024-05-15 22:18:18 +02:00
parent 7fc41dd573
commit f37b981f1b
2 changed files with 41 additions and 11 deletions

View File

@ -17,15 +17,17 @@ Prometheus settings.
## Method list:
* [`setEnablePrometheus(bool $enable): self`](#setEnablePrometheus)
* [`getEnablePrometheus(): bool`](#getEnablePrometheus)
* [`setPrometheusEndpoint(?\Amp\Socket\SocketAddress $endpoint): self`](#setPrometheusEndpoint)
* [`getPrometheusEndpoint(): ?\Amp\Socket\SocketAddress`](#getPrometheusEndpoint)
* [`setReturnMetricsFromStartAndLoop(bool $enable): self`](#setReturnMetricsFromStartAndLoop)
* [`getReturnMetricsFromStartAndLoop(): bool`](#getReturnMetricsFromStartAndLoop)
* [`setEnableCollection(bool $enable): self`](#setEnableCollection)
* [`getEnableCollection(): bool`](#getEnableCollection)
* [`setMetricsBindTo(?\Amp\Socket\SocketAddress $metricsBindTo): self`](#setMetricsBindTo)
* [`getMetricsBindTo(): ?\Amp\Socket\SocketAddress`](#getMetricsBindTo)
## Methods:
### <a name="setEnablePrometheus"></a> `setEnablePrometheus(bool $enable): self`
### <a name="setReturnMetricsFromStartAndLoop"></a> `setReturnMetricsFromStartAndLoop(bool $enable): self`
Whether to enable additional prometheus stat reporting for this session.
Whether to expose prometheus metrics with startAndLoop, by providing a ?metrics query string.
Parameters:
@ -34,20 +36,37 @@ Parameters:
### <a name="getEnablePrometheus"></a> `getEnablePrometheus(): bool`
### <a name="getReturnMetricsFromStartAndLoop"></a> `getReturnMetricsFromStartAndLoop(): bool`
Whether additional prometheus stat reporting is enabled for this session.
Whether to expose prometheus metrics with startAndLoop, by providing a ?metrics query string.
### <a name="setPrometheusEndpoint"></a> `setPrometheusEndpoint(?\Amp\Socket\SocketAddress $endpoint): self`
### <a name="setEnableCollection"></a> `setEnableCollection(bool $enable): self`
Whether to enable additional prometheus stat collection for this session.
Parameters:
* `$enable`: `bool`
### <a name="getEnableCollection"></a> `getEnableCollection(): bool`
Whether additional prometheus stat collection is enabled for this session.
### <a name="setMetricsBindTo"></a> `setMetricsBindTo(?\Amp\Socket\SocketAddress $metricsBindTo): self`
Whether to expose prometheus metrics on the specified endpoint via HTTP.
Parameters:
* `$endpoint`: `?\Amp\Socket\SocketAddress`
* `$metricsBindTo`: `?\Amp\Socket\SocketAddress`
#### See also:
@ -56,7 +75,7 @@ Parameters:
### <a name="getPrometheusEndpoint"></a> `getPrometheusEndpoint(): ?\Amp\Socket\SocketAddress`
### <a name="getMetricsBindTo"></a> `getMetricsBindTo(): ?\Amp\Socket\SocketAddress`
Whether to expose prometheus metrics on the specified endpoint via HTTP.

View File

@ -163,6 +163,8 @@ use danog\MadelineProto\Settings\Database\Redis;
use danog\MadelineProto\SimpleEventHandler;
use danog\MadelineProto\VoIP;
use function Amp\Socket\SocketAddress\fromString;
// MadelineProto is already loaded
if (class_exists(API::class)) {
// Otherwise, if a stable version of MadelineProto was installed via composer, load composer autoloader
@ -428,6 +430,15 @@ $settings->getLogger()->setLevel(Logger::LEVEL_ULTRA_VERBOSE);
// $settings->setDb((new Postgres)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
// $settings->setDb((new Mysql)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
// You can also enable collection of prometheus metrics.
// $settings->getPrometheus()->setEnableCollection(true);
// Metrics can be returned by an autoconfigured http://127.0.0.1:12345 HTTP server.
// $settings->getPrometheus()->setMetricsBindTo(fromString("127.0.0.1:12345"));
// Metrics can also be returned by the current script via web, if called with a ?metrics query string
// $settings->getPrometheus()->setReturnMetricsFromStartAndLoop(true);
// For users or bots
MyEventHandler::startAndLoop('bot.madeline', $settings);