protected function putDetailInfoIntoProfiler() {
		$profiler = $this->getProfiler();

		if (! $profiler instanceof ProfilerExtendedInterface) {
			return;
		}

		try {
			$infoRaw = $this->getDatabase()->command(['buildinfo' => 1]);
		} catch (Exception $exception) {
			$profiler->setAdditionalInfo([
				'Buildinfo command error' => $exception->getMessage()
			]);
			
			return;
		}

		$info = [
			'MongoDB version'    => $infoRaw['version'] . ' (' . $infoRaw['bits'] . '-bit)',
			'PHP driver version' => MongoClient::VERSION
		];

		foreach ($this->getClient()->getConnections() as $key => $connection) {
			$string = $connection['server']['host'] . ':' . $connection['server']['port'] . ' ';

			if (! empty($connection['server']['repl_set_name'])) {
				$string .= $connection['server']['repl_set_name'] . ':';
			}

			$string .= $connection['connection']['connection_type_desc'];
			$string .= ' ping: ' . $connection['connection']['ping_ms'] . 'ms';

			$info['Server ' . $key] = $string;
		}

		$profiler->setAdditionalInfo($info);
	}
protected function putDetailInfoIntoProfiler() {
		$profiler = $this->getProfiler();

		if (! $profiler instanceof ProfilerExtendedInterface) {
			return;
		}

		try {
			$infoRaw = $this->getDatabase()->command(['buildinfo' => 1]);
		} catch (Exception $exception) {
			$profiler->setAdditionalInfo([
				'Buildinfo command error' => $exception->getMessage()
			]);
			
			return;
		}

		$info = [
			'MongoDB version'    => $infoRaw['version'] . ' (' . $infoRaw['bits'] . '-bit)',
			'PHP driver version' => MongoClient::VERSION
		];

		foreach ($this->getClient()->getConnections() as $key => $connection) {
			$string = $connection['server']['host'] . ':' . $connection['server']['port'] . ' ';

			if (! empty($connection['server']['repl_set_name'])) {
				$string .= $connection['server']['repl_set_name'] . ':';
			}

			$string .= $connection['connection']['connection_type_desc'];
			$string .= ' ping: ' . $connection['connection']['ping_ms'] . 'ms';

			$info['Server ' . $key] = $string;
		}

		$profiler->setAdditionalInfo($info);
	}
protected function putDetailInfoIntoProfiler ( ) { $ profiler = $ this -> getProfiler ( ) ; if ( ! $ profiler instanceof ProfilerExtendedInterface ) { return ; } try { $ infoRaw = $ this -> getDatabase ( ) -> command ( [ 'buildinfo' => 1 ] ) ; } catch ( Exception $ exception ) { $ profiler -> setAdditionalInfo ( [ 'Buildinfo command error' => $ exception -> getMessage ( ) ] ) ; return ; } $ info = [ 'MongoDB version' => $ infoRaw [ 'version' ] . ' (' . $ infoRaw [ 'bits' ] . '-bit)' , 'PHP driver version' => MongoClient :: VERSION ] ; foreach ( $ this -> getClient ( ) -> getConnections ( ) as $ key => $ connection ) { $ string = $ connection [ 'server' ] [ 'host' ] . ':' . $ connection [ 'server' ] [ 'port' ] . ' ' ; if ( ! empty ( $ connection [ 'server' ] [ 'repl_set_name' ] ) ) { $ string .= $ connection [ 'server' ] [ 'repl_set_name' ] . ':' ; } $ string .= $ connection [ 'connection' ] [ 'connection_type_desc' ] ; $ string .= ' ping: ' . $ connection [ 'connection' ] [ 'ping_ms' ] . 'ms' ; $ info [ 'Server ' . $ key ] = $ string ; } $ profiler -> setAdditionalInfo ( $ info ) ; }
Collect an additional information about the MongoDB and a connection and put it to a profiler
Collect an additional information about the MongoDB and a connection and put it to a profiler