The MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent class

(mongodb >=1.13.0)

简介

The MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent class encapsulates information about a failed server heartbeat (i.e. » hello command issued through » server monitoring).

类摘要

final class MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent {
/* 属性 */
public readonly string $host;
public readonly int $port;
public readonly bool $awaited;
public readonly int $duration;
public readonly Exception $error;
/* 方法 */
final public getDurationMicros(): int
final public getError(): Exception
final public getHost(): string
final public getPort(): int
final public isAwaited(): bool
}

属性

host
The hostname of the server.
port
The port of the server.
awaited
Whether the heartbeat used a streaming protocol. The extension does not use the streaming protocol for monitoring, so this method will always return false.
duration
The duration of the heartbeat in microseconds. The duration is a calculated value that includes the time to send the message and receive the response from the server.
error
The exception that was thrown when the heartbeat failed.

更新日志

版本 说明
PECL mongodb 2.3.0 Added public readonly properties. The duration property replaces the getDurationMicros() method.

目录