diff --git a/docs/API_docs/methods/index.md b/docs/API_docs/methods/index.md index 34aac776d1..6d1586bb23 100644 --- a/docs/API_docs/methods/index.md +++ b/docs/API_docs/methods/index.md @@ -628,6 +628,8 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png * Get media autodownload settings: account.getAutoDownloadSettings +* Get memory profile with memprof: getMemoryProfile + * Get message ranges for saving the user's chat history: messages.getSplitRanges * Get message reaction list, along with the sender of each reaction: messages.getMessageReactionsList diff --git a/docs/PHP/danog/MadelineProto/API.md b/docs/PHP/danog/MadelineProto/API.md index 4e42c7cbb4..1fae961cf7 100644 --- a/docs/PHP/danog/MadelineProto/API.md +++ b/docs/PHP/danog/MadelineProto/API.md @@ -160,6 +160,7 @@ Main API wrapper for MadelineProto. * [`getLogger(): \danog\MadelineProto\Logger`](#getLogger) * [`getMaps(): ?int`](#getMaps) * [`getMaxMaps(): ?int`](#getMaxMaps) +* [`getMemoryProfile(): string`](#getMemoryProfile) * [`getMethodNamespaces(): array`](#getMethodNamespaces) * [`getMethodsNamespaced(): array`](#getMethodsNamespaced) * [`getMimeFromBuffer(string $buffer): string`](#getMimeFromBuffer) @@ -1430,6 +1431,12 @@ Use testFibers to get the maximum number of fibers on any platform. +### `getMemoryProfile(): string` + +Get memory profile with memprof. + + + ### `getMethodNamespaces(): array` Get TL namespaces. diff --git a/docs/PHP/danog/MadelineProto/EventHandler.md b/docs/PHP/danog/MadelineProto/EventHandler.md index 47b4615a87..d90aecd0f0 100644 --- a/docs/PHP/danog/MadelineProto/EventHandler.md +++ b/docs/PHP/danog/MadelineProto/EventHandler.md @@ -125,6 +125,7 @@ Event handler. * [`getLogger(): \danog\MadelineProto\Logger`](#getLogger) * [`getMaps(): ?int`](#getMaps) * [`getMaxMaps(): ?int`](#getMaxMaps) +* [`getMemoryProfile(): string`](#getMemoryProfile) * [`getMethodNamespaces(): array`](#getMethodNamespaces) * [`getMethodsNamespaced(): array`](#getMethodsNamespaced) * [`getMimeFromBuffer(string $buffer): string`](#getMimeFromBuffer) @@ -1438,6 +1439,12 @@ Use testFibers to get the maximum number of fibers on any platform. +### `getMemoryProfile(): string` + +Get memory profile with memprof. + + + ### `getMethodNamespaces(): array` Get TL namespaces. diff --git a/docs/PHP/danog/MadelineProto/EventHandler/Plugin/RestartPlugin.md b/docs/PHP/danog/MadelineProto/EventHandler/Plugin/RestartPlugin.md index 54cb431376..dd2f0556e0 100644 --- a/docs/PHP/danog/MadelineProto/EventHandler/Plugin/RestartPlugin.md +++ b/docs/PHP/danog/MadelineProto/EventHandler/Plugin/RestartPlugin.md @@ -127,6 +127,7 @@ Plugin that offers a /restart command to admins that can be used to restart the * [`getLogger(): \danog\MadelineProto\Logger`](#getLogger) * [`getMaps(): ?int`](#getMaps) * [`getMaxMaps(): ?int`](#getMaxMaps) +* [`getMemoryProfile(): string`](#getMemoryProfile) * [`getMethodNamespaces(): array`](#getMethodNamespaces) * [`getMethodsNamespaced(): array`](#getMethodsNamespaced) * [`getMimeFromBuffer(string $buffer): string`](#getMimeFromBuffer) @@ -1454,6 +1455,12 @@ Use testFibers to get the maximum number of fibers on any platform. +### `getMemoryProfile(): string` + +Get memory profile with memprof. + + + ### `getMethodNamespaces(): array` Get TL namespaces. diff --git a/docs/PHP/danog/MadelineProto/PluginEventHandler.md b/docs/PHP/danog/MadelineProto/PluginEventHandler.md index affeac8afb..a369c2f7f3 100644 --- a/docs/PHP/danog/MadelineProto/PluginEventHandler.md +++ b/docs/PHP/danog/MadelineProto/PluginEventHandler.md @@ -126,6 +126,7 @@ Plugin event handler class. * [`getLogger(): \danog\MadelineProto\Logger`](#getLogger) * [`getMaps(): ?int`](#getMaps) * [`getMaxMaps(): ?int`](#getMaxMaps) +* [`getMemoryProfile(): string`](#getMemoryProfile) * [`getMethodNamespaces(): array`](#getMethodNamespaces) * [`getMethodsNamespaced(): array`](#getMethodsNamespaced) * [`getMimeFromBuffer(string $buffer): string`](#getMimeFromBuffer) @@ -1437,6 +1438,12 @@ Use testFibers to get the maximum number of fibers on any platform. +### `getMemoryProfile(): string` + +Get memory profile with memprof. + + + ### `getMethodNamespaces(): array` Get TL namespaces. diff --git a/docs/PHP/danog/MadelineProto/Settings.md b/docs/PHP/danog/MadelineProto/Settings.md index 4631312b91..3a8bedbc37 100644 --- a/docs/PHP/danog/MadelineProto/Settings.md +++ b/docs/PHP/danog/MadelineProto/Settings.md @@ -27,8 +27,8 @@ Settings class used for configuring MadelineProto. * [`setConnection(\danog\MadelineProto\Settings\Connection $connection): self`](#setConnection) * [`getFiles(): \danog\MadelineProto\Settings\Files`](#getFiles) * [`setFiles(\danog\MadelineProto\Settings\Files $files): self`](#setFiles) -* [`getPrometheus(): \danog\MadelineProto\Settings\Prometheus`](#getPrometheus) -* [`setPrometheus(\danog\MadelineProto\Settings\Prometheus $prometheus): self`](#setPrometheus) +* [`getMetrics(): \danog\MadelineProto\Settings\Metrics`](#getMetrics) +* [`setMetrics(\danog\MadelineProto\Settings\Metrics $metrics): self`](#setMetrics) * [`getLogger(): \danog\MadelineProto\Settings\Logger`](#getLogger) * [`setLogger(\danog\MadelineProto\Settings\Logger $logger): self`](#setLogger) * [`getPeer(): \danog\MadelineProto\Settings\Peer`](#getPeer) @@ -182,29 +182,29 @@ Parameters: -### `getPrometheus(): \danog\MadelineProto\Settings\Prometheus` +### `getMetrics(): \danog\MadelineProto\Settings\Metrics` -Get prometheus settings. +Get metrics settings. #### See also: -* [`\danog\MadelineProto\Settings\Prometheus`: Prometheus settings.](../../danog/MadelineProto/Settings/Prometheus.html) +* [`\danog\MadelineProto\Settings\Metrics`: Metric settings.](../../danog/MadelineProto/Settings/Metrics.html) -### `setPrometheus(\danog\MadelineProto\Settings\Prometheus $prometheus): self` +### `setMetrics(\danog\MadelineProto\Settings\Metrics $metrics): self` -Set prometheus settings. +Set metrics settings. Parameters: -* `$prometheus`: `\danog\MadelineProto\Settings\Prometheus` File management settings. +* `$metrics`: `\danog\MadelineProto\Settings\Metrics` File management settings. #### See also: -* [`\danog\MadelineProto\Settings\Prometheus`: Prometheus settings.](../../danog/MadelineProto/Settings/Prometheus.html) +* [`\danog\MadelineProto\Settings\Metrics`: Metric settings.](../../danog/MadelineProto/Settings/Metrics.html) diff --git a/docs/PHP/danog/MadelineProto/Settings/Prometheus.md b/docs/PHP/danog/MadelineProto/Settings/Metrics.md similarity index 52% rename from docs/PHP/danog/MadelineProto/Settings/Prometheus.md rename to docs/PHP/danog/MadelineProto/Settings/Metrics.md index 63ad350850..85a823ef41 100644 --- a/docs/PHP/danog/MadelineProto/Settings/Prometheus.md +++ b/docs/PHP/danog/MadelineProto/Settings/Metrics.md @@ -1,17 +1,17 @@ --- -title: "danog\\MadelineProto\\Settings\\Prometheus: Prometheus settings." +title: "danog\\MadelineProto\\Settings\\Metrics: Metric settings." description: "" image: "https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png" parent: "MadelineProto API" --- -# `danog\MadelineProto\Settings\Prometheus` +# `danog\MadelineProto\Settings\Metrics` [Back to index](../../../index.html) > Author: Daniil Gentili -Prometheus settings. +Metric settings. @@ -19,15 +19,17 @@ Prometheus settings. ## Method list: * [`setReturnMetricsFromStartAndLoop(bool $enable): self`](#setReturnMetricsFromStartAndLoop) * [`getReturnMetricsFromStartAndLoop(): bool`](#getReturnMetricsFromStartAndLoop) -* [`setEnableCollection(bool $enable): self`](#setEnableCollection) -* [`getEnableCollection(): bool`](#getEnableCollection) +* [`setEnablePrometheusCollection(bool $enable): self`](#setEnablePrometheusCollection) +* [`getEnablePrometheusCollection(): bool`](#getEnablePrometheusCollection) +* [`setEnableMemprofCollection(bool $enable): self`](#setEnableMemprofCollection) +* [`getEnableMemprofCollection(): bool`](#getEnableMemprofCollection) * [`setMetricsBindTo(?\Amp\Socket\SocketAddress $metricsBindTo): self`](#setMetricsBindTo) * [`getMetricsBindTo(): ?\Amp\Socket\SocketAddress`](#getMetricsBindTo) ## Methods: ### `setReturnMetricsFromStartAndLoop(bool $enable): self` -Whether to expose prometheus metrics with startAndLoop, by providing a ?metrics query string. +Whether to expose prometheus/memprof metrics with startAndLoop, by providing a ?metrics or ?pprof query string. Parameters: @@ -38,11 +40,11 @@ Parameters: ### `getReturnMetricsFromStartAndLoop(): bool` -Whether to expose prometheus metrics with startAndLoop, by providing a ?metrics query string. +Whether to expose prometheus/memprof metrics with startAndLoop, by providing a ?metrics or ?pprof query string. -### `setEnableCollection(bool $enable): self` +### `setEnablePrometheusCollection(bool $enable): self` Whether to enable additional prometheus stat collection for this session. @@ -53,15 +55,32 @@ Parameters: -### `getEnableCollection(): bool` +### `getEnablePrometheusCollection(): bool` Whether additional prometheus stat collection is enabled for this session. +### `setEnableMemprofCollection(bool $enable): self` + +Whether to enable memprof memory stat collection for this session. + + +Parameters: + +* `$enable`: `bool` + + + +### `getEnableMemprofCollection(): bool` + +Whether to enable memprof memory stat collection for this session. + + + ### `setMetricsBindTo(?\Amp\Socket\SocketAddress $metricsBindTo): self` -Whether to expose prometheus metrics on the specified endpoint via HTTP. +Whether to expose metrics on the specified endpoint via HTTP. Parameters: @@ -77,7 +96,7 @@ Parameters: ### `getMetricsBindTo(): ?\Amp\Socket\SocketAddress` -Whether to expose prometheus metrics on the specified endpoint via HTTP. +Whether to expose metrics on the specified endpoint via HTTP. #### See also: diff --git a/docs/PHP/danog/MadelineProto/SimpleEventHandler.md b/docs/PHP/danog/MadelineProto/SimpleEventHandler.md index 14eca61096..2518c7446d 100644 --- a/docs/PHP/danog/MadelineProto/SimpleEventHandler.md +++ b/docs/PHP/danog/MadelineProto/SimpleEventHandler.md @@ -125,6 +125,7 @@ Simple event handler class: by extending this class, you can use filters, crons * [`getLogger(): \danog\MadelineProto\Logger`](#getLogger) * [`getMaps(): ?int`](#getMaps) * [`getMaxMaps(): ?int`](#getMaxMaps) +* [`getMemoryProfile(): string`](#getMemoryProfile) * [`getMethodNamespaces(): array`](#getMethodNamespaces) * [`getMethodsNamespaced(): array`](#getMethodsNamespaced) * [`getMimeFromBuffer(string $buffer): string`](#getMimeFromBuffer) @@ -1438,6 +1439,12 @@ Use testFibers to get the maximum number of fibers on any platform. +### `getMemoryProfile(): string` + +Get memory profile with memprof. + + + ### `getMethodNamespaces(): array` Get TL namespaces. diff --git a/docs/PHP/index.md b/docs/PHP/index.md index 849d0c8196..be89bf7f56 100644 --- a/docs/PHP/index.md +++ b/docs/PHP/index.md @@ -344,8 +344,8 @@ Async PHP client API for the telegram MTProto protocol. * [\danog\MadelineProto\Settings\Files: File management settings.](/PHP/danog/MadelineProto/Settings/Files.html) * [\danog\MadelineProto\Settings\Ipc: IPC server settings.](/PHP/danog/MadelineProto/Settings/Ipc.html) * [\danog\MadelineProto\Settings\Logger: Logger settings.](/PHP/danog/MadelineProto/Settings/Logger.html) +* [\danog\MadelineProto\Settings\Metrics: Metric settings.](/PHP/danog/MadelineProto/Settings/Metrics.html) * [\danog\MadelineProto\Settings\Peer: Peer database settings.](/PHP/danog/MadelineProto/Settings/Peer.html) -* [\danog\MadelineProto\Settings\Prometheus: Prometheus settings.](/PHP/danog/MadelineProto/Settings/Prometheus.html) * [\danog\MadelineProto\Settings\Pwr: PWRTelegram settings.](/PHP/danog/MadelineProto/Settings/Pwr.html) * [\danog\MadelineProto\Settings\RPC: RPC settings.](/PHP/danog/MadelineProto/Settings/RPC.html) * [\danog\MadelineProto\Settings\SecretChats: Secret chat settings.](/PHP/danog/MadelineProto/Settings/SecretChats.html) diff --git a/docs/docs/UPDATES.md b/docs/docs/UPDATES.md index bccfa5886c..0ee2ff2145 100644 --- a/docs/docs/UPDATES.md +++ b/docs/docs/UPDATES.md @@ -430,14 +430,27 @@ $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); +// You can also enable collection of additional prometheus metrics. +// $settings->getMetrics()->setEnablePrometheusCollection(true); + +// You can also enable collection of additional memory profiling metrics. +// $settings->getMetrics()->setEnableMemprofCollection(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")); +// +// 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 ?metrics query string -// $settings->getPrometheus()->setReturnMetricsFromStartAndLoop(true); +// 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 MyEventHandler::startAndLoop('bot.madeline', $settings); @@ -1376,4 +1389,4 @@ $MadelineProto = new \danog\MadelineProto\API('bot.madeline'); echo json_encode($MadelineProto->getUpdates($_GET)); ``` -Next section \ No newline at end of file +Next section diff --git a/docs/index.md b/docs/index.md index 300708a5b9..2e5f3f411a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -595,6 +595,7 @@ Some of MadelineProto's core components are also available as separate, standalo * Get logger: getLogger * Get maximum number of memory-mapped regions, UNIX only: getMaxMaps * Get media autodownload settings: account.getAutoDownloadSettings + * Get memory profile with memprof: getMemoryProfile * Get message ranges for saving the user's chat history: messages.getSplitRanges * Get message reaction list, along with the sender of each reaction: messages.getMessageReactionsList * Get message reactions ยป: messages.getMessagesReactions