This commit is contained in:
Daniil Gentili 2024-05-29 22:46:27 +02:00
parent 6bfc029018
commit 6a47633e88

View File

@ -163,6 +163,8 @@ use danog\MadelineProto\Settings\Database\Redis;
use danog\MadelineProto\SimpleEventHandler; use danog\MadelineProto\SimpleEventHandler;
use danog\MadelineProto\VoIP; use danog\MadelineProto\VoIP;
use function Amp\Socket\SocketAddress\fromString;
// MadelineProto is already loaded // MadelineProto is already loaded
if (class_exists(API::class)) { if (class_exists(API::class)) {
// Otherwise, if a stable version of MadelineProto was installed via composer, load composer autoloader // Otherwise, if a stable version of MadelineProto was installed via composer, load composer autoloader
@ -428,6 +430,29 @@ $settings->getLogger()->setLevel(Logger::LEVEL_ULTRA_VERBOSE);
// $settings->setDb((new Postgres)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony')); // $settings->setDb((new Postgres)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
// $settings->setDb((new Mysql)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony')); // $settings->setDb((new Mysql)->setDatabase('MadelineProto')->setUsername('daniil')->setPassword('pony'));
// You can also enable collection of additional prometheus metrics.
// $settings->getMetrics()->setEnablePrometheusCollection(true);
// You can also enable collection of additional memory profiling metrics.
// Note: you must also set the MEMPROF_PROFILE=1 environment variable or GET parameter.
// $settings->getMetrics()->setEnableMemprofCollection(true);
// Metrics can be returned by an autoconfigured http://127.0.0.1:12345 HTTP server.
//
// Endpoints:
//
// /metrics - Prometheus metrics
// /debug/pprof - PProf memory profile for pyroscope
//
// $settings->getMetrics()->setMetricsBindTo(fromString("127.0.0.1:12345"));
// Metrics can also be returned by the current script via web, if called with a specific query string:
//
// ?metrics - Prometheus metrics
// ?pprof - PProf memory profile for pyroscope
//
// $settings->getMetrics()->setReturnMetricsFromStartAndLoop(true);
// For users or bots // For users or bots
MyEventHandler::startAndLoop('bot.madeline', $settings); MyEventHandler::startAndLoop('bot.madeline', $settings);