Monitoring classes and subscriber functions

目次

The MongoDB\Driver\Monitoring\CommandFailedEvent class

はじめに

The MongoDB\Driver\Monitoring\CommandFailedEvent class encapsulates information about a failed command.

クラス概要

MongoDB\Driver\Monitoring\CommandFailedEvent
final class MongoDB\Driver\Monitoring\CommandFailedEvent {
/* メソッド */
final public string getCommandName()
final public int getDurationMicros()
final public Exception getError()
final public string getOperationId()
final public object getReply()
final public string getRequestId()
final public MongoDB\Driver\Server getServer()
final public intnull getServerConnectionId()
final public MongoDB\BSON\ObjectIdnull getServiceId()
}

The MongoDB\Driver\Monitoring\CommandStartedEvent class

はじめに

The MongoDB\Driver\Monitoring\CommandStartedEvent class encapsulates information about a started command.

クラス概要

MongoDB\Driver\Monitoring\CommandStartedEvent
final class MongoDB\Driver\Monitoring\CommandStartedEvent {
/* メソッド */
final public object getCommand()
final public string getCommandName()
final public string getDatabaseName()
final public string getOperationId()
final public string getRequestId()
final public MongoDB\Driver\Server getServer()
final public intnull getServerConnectionId()
final public MongoDB\BSON\ObjectIdnull getServiceId()
}

The MongoDB\Driver\Monitoring\CommandSucceededEvent class

はじめに

The MongoDB\Driver\Monitoring\CommandSucceededEvent class encapsulates information about a successful command.

クラス概要

MongoDB\Driver\Monitoring\CommandSucceededEvent
final class MongoDB\Driver\Monitoring\CommandSucceededEvent {
/* メソッド */
final public string getCommandName()
final public int getDurationMicros()
final public string getOperationId()
final public object getReply()
final public string getRequestId()
final public MongoDB\Driver\Server getServer()
final public intnull getServerConnectionId()
final public MongoDB\BSON\ObjectIdnull getServiceId()
}

The MongoDB\Driver\Monitoring\ServerChangedEvent class

はじめに

The MongoDB\Driver\Monitoring\ServerChangedEvent class encapsulates information about a changed server description.

クラス概要

MongoDB\Driver\Monitoring\ServerChangedEvent
final class MongoDB\Driver\Monitoring\ServerChangedEvent {
/* メソッド */
final public string getHost()
final public MongoDB\Driver\ServerDescription getNewDescription()
final public int getPort()
final public MongoDB\Driver\ServerDescription getPreviousDescription()
final public MongoDB\BSON\ObjectId getTopologyId()
}

The MongoDB\Driver\Monitoring\ServerClosedEvent class

はじめに

The MongoDB\Driver\Monitoring\ServerClosedEvent class encapsulates information about a closed server.

クラス概要

MongoDB\Driver\Monitoring\ServerClosedEvent
final class MongoDB\Driver\Monitoring\ServerClosedEvent {
/* メソッド */
final public string getHost()
final public int getPort()
final public MongoDB\BSON\ObjectId getTopologyId()
}

The MongoDB\Driver\Monitoring\ServerOpeningEvent class

はじめに

The MongoDB\Driver\Monitoring\ServerOpeningEvent class encapsulates information about an opened server.

クラス概要

MongoDB\Driver\Monitoring\ServerOpeningEvent
final class MongoDB\Driver\Monitoring\ServerOpeningEvent {
/* メソッド */
final public string getHost()
final public int getPort()
final public MongoDB\BSON\ObjectId getTopologyId()
}

The MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent class

はじめに

The MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent class encapsulates information about a failed server heartbeat.

クラス概要

MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent
final class MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent {
/* メソッド */
final public int getDurationMicros()
final public Exception getError()
final public string getHost()
final public int getPort()
final public bool isAwaited()
}

The MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent class

はじめに

The MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent class encapsulates information about a started server heartbeat.

クラス概要

MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent
final class MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent {
/* メソッド */
final public string getHost()
final public int getPort()
final public bool isAwaited()
}

The MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent class

はじめに

The MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent class encapsulates information about a successful server heartbeat.

クラス概要

MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent
final class MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent {
/* メソッド */
final public int getDurationMicros()
final public string getHost()
final public int getPort()
final public object getReply()
final public bool isAwaited()
}

The MongoDB\Driver\Monitoring\TopologyChangedEvent class

はじめに

The MongoDB\Driver\Monitoring\TopologyChangedEvent class encapsulates information about a changed topology description.

クラス概要

MongoDB\Driver\Monitoring\TopologyChangedEvent
final class MongoDB\Driver\Monitoring\TopologyChangedEvent {
/* メソッド */
final public MongoDB\Driver\TopologyDescription getNewDescription()
final public MongoDB\Driver\TopologyDescription getPreviousDescription()
final public MongoDB\BSON\ObjectId getTopologyId()
}

The MongoDB\Driver\Monitoring\TopologyClosedEvent class

はじめに

The MongoDB\Driver\Monitoring\TopologyClosedEvent class encapsulates information about a closed topology.

クラス概要

MongoDB\Driver\Monitoring\TopologyClosedEvent
final class MongoDB\Driver\Monitoring\TopologyClosedEvent {
/* メソッド */
final public MongoDB\BSON\ObjectId getTopologyId()
}

The MongoDB\Driver\Monitoring\TopologyOpeningEvent class

はじめに

The MongoDB\Driver\Monitoring\TopologyOpeningEvent class encapsulates information about an opened topology.

クラス概要

MongoDB\Driver\Monitoring\TopologyOpeningEvent
final class MongoDB\Driver\Monitoring\TopologyOpeningEvent {
/* メソッド */
final public MongoDB\BSON\ObjectId getTopologyId()
}

The MongoDB\Driver\Monitoring\CommandSubscriber interface

はじめに

Classes may implement this interface to register an event subscriber that is notified for each started, successful, and failed command event. See Application Performance Monitoring (APM) for additional information.

インターフェイス概要

MongoDB\Driver\Monitoring\CommandSubscriber
class MongoDB\Driver\Monitoring\CommandSubscriber implements MongoDB\Driver\Monitoring\Subscriber {
/* メソッド */
abstract public void commandFailed(MongoDB\Driver\Monitoring\CommandFailedEvent $event)
abstract public void commandStarted(MongoDB\Driver\Monitoring\CommandStartedEvent $event)
abstract public void commandSucceeded(MongoDB\Driver\Monitoring\CommandSucceededEvent $event)
}

変更履歴

バージョン 説明
PECL mongodb 1.15.0 Return types for methods are declared as tentative on PHP 8.0 and newer, triggering deprecation notices in code that implements this interface without declaring the appropriate return types. The #[ReturnTypeWillChange] attribute can be added to silence the deprecation notice.

The MongoDB\Driver\Monitoring\LogSubscriber interface

はじめに

Classes implementing this interface may be registered as a subscriber and receive log messages from the driver. This is similar to stream-based debug logging (i.e. mongodb.debug) except that trace-level log messages are not received.

As with stream-based logging, it is only possible to register a logger globally using MongoDB\Driver\Monitoring\addSubscriber. The driver is not able to distinguish log messages for individual MongoDB\Driver\Manager objects.

インターフェイス概要

MongoDB\Driver\Monitoring\LogSubscriber
class MongoDB\Driver\Monitoring\LogSubscriber implements MongoDB\Driver\Monitoring\Subscriber {
/* 定数 */
const int MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_ERROR = 0;
const int MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_CRITICAL = 1;
const int MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_WARNING = 2;
const int MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_MESSAGE = 3;
const int MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_INFO = 4;
const int MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_DEBUG = 5;
/* メソッド */
abstract public void log(int $level, string $domain, string $message)
}

定義済み定数

MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_ERROR

Error log level. An error condition that the driver is unable to report through its API. This is the most severe log level in the driver.

MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_CRITICAL

Critical log level. An error condition with slightly less severity. This constant exists for consistency with libmongoc; however, the driver is unlikely to use it in practice.

MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_WARNING

Warning log level. Indicates a situation where undesirable application behavior may occur.

MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_MESSAGE

Message or notice log level. Indicates an event that is unusual but not problematic.

MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_INFO

Info log level. High-level information about normal driver behavior.

MongoDB\Driver\Monitoring\LogSubscriber::LEVEL_DEBUG

Debug log level. Detailed information that may be helpful when debugging an application.

The MongoDB\Driver\Monitoring\SDAMSubscriber interface

はじめに

Classes may implement this interface to register an event subscriber that is notified for various SDAM events. See the » Server Discovery and Monitoring and » SDAM Monitoring specifications for additional information.

インターフェイス概要

MongoDB\Driver\Monitoring\SDAMSubscriber
class MongoDB\Driver\Monitoring\SDAMSubscriber implements MongoDB\Driver\Monitoring\Subscriber {
/* メソッド */
abstract public void serverChanged(MongoDB\Driver\Monitoring\ServerChangedEvent $event)
abstract public void serverClosed(MongoDB\Driver\Monitoring\ServerClosedEvent $event)
abstract public void serverHeartbeatFailed(MongoDB\Driver\Monitoring\ServerHeartbeatFailedEvent $event)
abstract public void serverHeartbeatStarted(MongoDB\Driver\Monitoring\ServerHeartbeatStartedEvent $event)
abstract public void serverHeartbeatSucceeded(MongoDB\Driver\Monitoring\ServerHeartbeatSucceededEvent $event)
abstract public void serverOpening(MongoDB\Driver\Monitoring\ServerOpeningEvent $event)
abstract public void topologyChanged(MongoDB\Driver\Monitoring\TopologyChangedEvent $event)
abstract public void topologyClosed(MongoDB\Driver\Monitoring\TopologyClosedEvent $event)
abstract public void topologyOpening(MongoDB\Driver\Monitoring\TopologyOpeningEvent $event)
}

変更履歴

バージョン 説明
PECL mongodb 1.15.0 Return types for methods are declared as tentative on PHP 8.0 and newer, triggering deprecation notices in code that implements this interface without declaring the appropriate return types. The #[ReturnTypeWillChange] attribute can be added to silence the deprecation notice.

The MongoDB\Driver\Monitoring\Subscriber interface

はじめに

Base interface for event subscribers. This is used as a parameter type in the functions MongoDB\Driver\Monitoring\addSubscriber and MongoDB\Driver\Monitoring\removeSubscriber and should not be implemented directly.

インターフェイス概要

MongoDB\Driver\Monitoring\Subscriber
class MongoDB\Driver\Monitoring\Subscriber {
}

This interface has no methods. Its only purpose is to be the base interface for all event subscribers.