This commit is contained in:
Daniil Gentili 2024-05-20 17:44:45 +02:00
parent f37b981f1b
commit ef96429069
11 changed files with 97 additions and 27 deletions

View File

@ -628,6 +628,8 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
* <a href="account.getAutoDownloadSettings.html" name="account.getAutoDownloadSettings">Get media autodownload settings: account.getAutoDownloadSettings</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getMemoryProfile" name="getMemoryProfile">Get memory profile with memprof: getMemoryProfile</a>
* <a href="messages.getSplitRanges.html" name="messages.getSplitRanges">Get message ranges for saving the user's chat history: messages.getSplitRanges</a>
* <a href="messages.getMessageReactionsList.html" name="messages.getMessageReactionsList">Get message reaction list, along with the sender of each reaction: messages.getMessageReactionsList</a>

View File

@ -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.
### <a name="getMemoryProfile"></a> `getMemoryProfile(): string`
Get memory profile with memprof.
### <a name="getMethodNamespaces"></a> `getMethodNamespaces(): array`
Get TL namespaces.

View File

@ -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.
### <a name="getMemoryProfile"></a> `getMemoryProfile(): string`
Get memory profile with memprof.
### <a name="getMethodNamespaces"></a> `getMethodNamespaces(): array`
Get TL namespaces.

View File

@ -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.
### <a name="getMemoryProfile"></a> `getMemoryProfile(): string`
Get memory profile with memprof.
### <a name="getMethodNamespaces"></a> `getMethodNamespaces(): array`
Get TL namespaces.

View File

@ -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.
### <a name="getMemoryProfile"></a> `getMemoryProfile(): string`
Get memory profile with memprof.
### <a name="getMethodNamespaces"></a> `getMethodNamespaces(): array`
Get TL namespaces.

View File

@ -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:
### <a name="getPrometheus"></a> `getPrometheus(): \danog\MadelineProto\Settings\Prometheus`
### <a name="getMetrics"></a> `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)
### <a name="setPrometheus"></a> `setPrometheus(\danog\MadelineProto\Settings\Prometheus $prometheus): self`
### <a name="setMetrics"></a> `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)

View File

@ -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 <daniil@daniil.it>
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:
### <a name="setReturnMetricsFromStartAndLoop"></a> `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:
### <a name="getReturnMetricsFromStartAndLoop"></a> `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.
### <a name="setEnableCollection"></a> `setEnableCollection(bool $enable): self`
### <a name="setEnablePrometheusCollection"></a> `setEnablePrometheusCollection(bool $enable): self`
Whether to enable additional prometheus stat collection for this session.
@ -53,15 +55,32 @@ Parameters:
### <a name="getEnableCollection"></a> `getEnableCollection(): bool`
### <a name="getEnablePrometheusCollection"></a> `getEnablePrometheusCollection(): bool`
Whether additional prometheus stat collection is enabled for this session.
### <a name="setEnableMemprofCollection"></a> `setEnableMemprofCollection(bool $enable): self`
Whether to enable memprof memory stat collection for this session.
Parameters:
* `$enable`: `bool`
### <a name="getEnableMemprofCollection"></a> `getEnableMemprofCollection(): bool`
Whether to enable memprof memory stat collection for this session.
### <a name="setMetricsBindTo"></a> `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:
### <a name="getMetricsBindTo"></a> `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:

View File

@ -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.
### <a name="getMemoryProfile"></a> `getMemoryProfile(): string`
Get memory profile with memprof.
### <a name="getMethodNamespaces"></a> `getMethodNamespaces(): array`
Get TL namespaces.

View File

@ -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)

View File

@ -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));
```
<a href="https://docs.madelineproto.xyz/docs/FILTERS.html">Next section</a>
<a href="https://docs.madelineproto.xyz/docs/FILTERS.html">Next section</a>

View File

@ -595,6 +595,7 @@ Some of MadelineProto's core components are also available as separate, standalo
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getLogger" name="getLogger">Get logger: getLogger</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getMaxMaps" name="getMaxMaps">Get maximum number of memory-mapped regions, UNIX only: getMaxMaps</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getAutoDownloadSettings.html" name="account.getAutoDownloadSettings">Get media autodownload settings: account.getAutoDownloadSettings</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getMemoryProfile" name="getMemoryProfile">Get memory profile with memprof: getMemoryProfile</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getSplitRanges.html" name="messages.getSplitRanges">Get message ranges for saving the user's chat history: messages.getSplitRanges</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getMessageReactionsList.html" name="messages.getMessageReactionsList">Get message reaction list, along with the sender of each reaction: messages.getMessageReactionsList</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getMessagesReactions.html" name="messages.getMessagesReactions">Get message reactions »: messages.getMessagesReactions</a>