MetricsHandler
class MetricsHandler
Traits
Properties
| protected PendingMetric> | $metrics | The metrics being gathered. |
|
| protected Channel> | $waiters | The waiters for metrics being gathered from sibling workers. |
Methods
Get meta / status information for the given channels.
Get meta / status information for the given channel.
Create an instance of the metrics handler.
Gather the metrics for the given type.
Get the local metrics for the given type.
Gather metrics from all subscribers for the given type.
Gather metrics from this worker and every sibling worker.
Merge the given metrics into a single result set.
Merge multiple channel instances into a single set.
Merge multiple sets of channel instances into a single result set.
Merge presence snapshots into one node-wide view.
Add distributed merge data when exact user counts were requested.
Append a response to a pending metric.
Wait for a pending metric or return every response received before the deadline.
Details
in
InteractsWithChannelInformation at line 18
protected array
infoForChannels(Application $application, array $channels, string $info, bool $includeUserIds = false)
Get meta / status information for the given channels.
in
InteractsWithChannelInformation at line 36
protected array
info(Application $application, string $channel, string $info, bool $includeUserIds = false)
Get meta / status information for the given channel.
in
InteractsWithChannelInformation at line 87
protected bool
isPresenceChannel(Channel $channel)
Determine if the given channel is a presence channel.
in
InteractsWithChannelInformation at line 95
protected bool
isCacheChannel(Channel $channel)
Determine if the given channel is a cache channel.
in
InteractsWithChannelInformation at line 103
protected int
userCount(Channel $channel)
Get the number of unique users subscribed to the presence channel.
in
InteractsWithChannelInformation at line 111
protected array
userIds(Channel $channel)
Get the unique user IDs subscribed to the presence channel.
at line 42
__construct(ServerProviderManager $serverProviderManager, ChannelManager $channels, PubSubProvider $pubSubProvider, Server $server)
Create an instance of the metrics handler.
at line 53
array
gather(Application $application, string $type, array $options = [])
Gather the metrics for the given type.
at line 79
array
get(PendingMetric $metric)
Get the metrics for the given type.
at line 87
protected array
getLocal(Application $application, MetricType $type, array $options)
Get the local metrics for the given type.
at line 100
protected array
channel(Application $application, array $options)
Get the channel for the given application.
at line 113
protected array
channels(Application $application, array $options)
Get the channels for the given application.
at line 143
protected array
connections(Application $application)
Get the connections for the given application.
at line 151
protected array
presence(Application $application, array $options)
Get a local presence-channel snapshot.
at line 183
protected array
gatherMetricsFromSubscribers(PendingMetric $metric)
Gather metrics from all subscribers for the given type.
Uses a Swoole coroutine channel with timeout instead of ReactPHP promises.
at line 231
protected array
gatherMetricsFromWorkers(PendingMetric $metric, int $workerCount)
Gather metrics from this worker and every sibling worker.
at line 279
void
receive(MetricsResponsePipeMessage $message)
Receive a metrics response from a sibling worker.
at line 287
protected array
mergeSubscriberMetrics(array $metrics, MetricType $type)
Merge the given metrics into a single result set.
at line 302
protected array
mergeChannel(array $metrics)
Merge multiple channel instances into a single set.
at line 328
protected array
mergeChannels(array $metrics)
Merge multiple sets of channel instances into a single result set.
at line 347
protected array
mergePresence(array $metrics)
Merge presence snapshots into one node-wide view.
at line 371
void
publish(PendingMetric $metric)
Publish the metrics for the given type.
Called by the pub/sub message handler when this node receives a metrics request.
at line 382
protected array
distributedOptions(MetricType $type, array $options)
Add distributed merge data when exact user counts were requested.
at line 400
protected Channel
startGathering(PendingMetric $metric)
Register a pending metric and its waiter.
at line 413
protected void
appendMetric(string $key, array $payload)
Append a response to a pending metric.
at line 432
protected array
waitForMetric(PendingMetric $metric, Channel $waiter)
Wait for a pending metric or return every response received before the deadline.
at line 458
protected void
stopGathering(PendingMetric $metric)
Remove a pending metric and its waiter.