diff --git a/src/MongoDB/Monitoring/CommandFailedEvent.c b/src/MongoDB/Monitoring/CommandFailedEvent.c index 75a8e3e2e..b9a13c1ed 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent.c +++ b/src/MongoDB/Monitoring/CommandFailedEvent.c @@ -79,6 +79,16 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getError) RETURN_ZVAL(&intern->z_error, 1, 0); } +/* Returns this event's host */ +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getHost) +{ + php_phongo_commandfailedevent_t* intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis()); + + PHONGO_PARSE_PARAMETERS_NONE(); + + RETVAL_STRING(intern->host.host); +} + /* Returns the event's operation ID */ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getOperationId) { @@ -93,6 +103,16 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getOperationId) RETVAL_STRING(operation_id); } +/* Returns this event's port */ +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getPort) +{ + php_phongo_commandfailedevent_t* intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis()); + + PHONGO_PARSE_PARAMETERS_NONE(); + + RETVAL_LONG(intern->host.port); +} + /* Returns the reply document associated with the event */ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getReply) { @@ -233,17 +253,16 @@ static HashTable* php_phongo_commandfailedevent_get_debug_info(phongo_compat_obj intern = Z_OBJ_COMMANDFAILEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); *is_temp = 1; - array_init_size(&retval, 6); + array_init_size(&retval, 11); + ADD_ASSOC_STRING(&retval, "host", intern->host.host); + ADD_ASSOC_LONG_EX(&retval, "port", intern->host.port); ADD_ASSOC_STRING(&retval, "commandName", intern->command_name); ADD_ASSOC_INT64(&retval, "durationMicros", intern->duration_micros); ADD_ASSOC_ZVAL_EX(&retval, "error", &intern->z_error); Z_ADDREF(intern->z_error); - snprintf(operation_id, sizeof(operation_id), "%" PRId64, intern->operation_id); - ADD_ASSOC_STRING(&retval, "operationId", operation_id); - if (!php_phongo_bson_to_zval_ex(intern->reply, &reply_state)) { zval_ptr_dtor(&reply_state.zchild); goto done; @@ -251,6 +270,9 @@ static HashTable* php_phongo_commandfailedevent_get_debug_info(phongo_compat_obj ADD_ASSOC_ZVAL(&retval, "reply", &reply_state.zchild); + snprintf(operation_id, sizeof(operation_id), "%" PRId64, intern->operation_id); + ADD_ASSOC_STRING(&retval, "operationId", operation_id); + snprintf(request_id, sizeof(request_id), "%" PRId64, intern->request_id); ADD_ASSOC_STRING(&retval, "requestId", request_id); diff --git a/src/MongoDB/Monitoring/CommandFailedEvent.stub.php b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php index 9c8c9041b..22dc30616 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandFailedEvent.stub.php @@ -19,12 +19,17 @@ final public function getDurationMicros(): int {} final public function getError(): \Exception {} + final public function getHost(): string {} + final public function getOperationId(): string {} + final public function getPort(): int {} + final public function getReply(): object {} final public function getRequestId(): string {} + /** @deprecated */ final public function getServer(): \MongoDB\Driver\Server {} final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} diff --git a/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h b/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h index d193f7075..39d94c991 100644 --- a/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 6fd7c6597ad8e67b399cf4e7c41bb6cc5e6666d6 */ + * Stub hash: 3e04d69c1e4a42ee94149ac14ce1f3595448b472 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -15,8 +15,12 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getError, 0, 0, Exception, 0) ZEND_END_ARG_INFO() +#define arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getHost arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getCommandName + #define arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getOperationId arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getCommandName +#define arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getPort arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getDurationMicros + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getReply, 0, 0, IS_OBJECT, 0) ZEND_END_ARG_INFO() @@ -37,7 +41,9 @@ static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getCommandName) static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getDatabaseName); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getDurationMicros); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getError); +static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getHost); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getOperationId); +static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getPort); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getReply); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getRequestId); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandFailedEvent, getServer); @@ -51,10 +57,12 @@ static const zend_function_entry class_MongoDB_Driver_Monitoring_CommandFailedEv ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getDatabaseName, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getDatabaseName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getDurationMicros, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getDurationMicros, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getError, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getError, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getHost, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getHost, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getOperationId, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getOperationId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getPort, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getPort, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getReply, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getReply, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getRequestId, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getRequestId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getServer, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getServer, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL|ZEND_ACC_DEPRECATED) ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getServiceId, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getServiceId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandFailedEvent, getServerConnectionId, arginfo_class_MongoDB_Driver_Monitoring_CommandFailedEvent_getServerConnectionId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END diff --git a/src/MongoDB/Monitoring/CommandStartedEvent.c b/src/MongoDB/Monitoring/CommandStartedEvent.c index f45159e8c..aa109649b 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent.c +++ b/src/MongoDB/Monitoring/CommandStartedEvent.c @@ -75,6 +75,16 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getDatabaseName RETVAL_STRING(intern->database_name); } +/* Returns this event's host */ +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getHost) +{ + php_phongo_commandstartedevent_t* intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis()); + + PHONGO_PARSE_PARAMETERS_NONE(); + + RETVAL_STRING(intern->host.host); +} + /* Returns the event's operation ID */ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getOperationId) { @@ -89,6 +99,16 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getOperationId) RETVAL_STRING(operation_id); } +/* Returns this event's port */ +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getPort) +{ + php_phongo_commandstartedevent_t* intern = Z_COMMANDSTARTEDEVENT_OBJ_P(getThis()); + + PHONGO_PARSE_PARAMETERS_NONE(); + + RETVAL_LONG(intern->host.port); +} + /* Returns the event's request ID */ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getRequestId) { @@ -205,7 +225,12 @@ static HashTable* php_phongo_commandstartedevent_get_debug_info(phongo_compat_ob intern = Z_OBJ_COMMANDSTARTEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); *is_temp = 1; - array_init_size(&retval, 6); + array_init_size(&retval, 10); + + ADD_ASSOC_STRING(&retval, "host", intern->host.host); + ADD_ASSOC_LONG_EX(&retval, "port", intern->host.port); + ADD_ASSOC_STRING(&retval, "commandName", intern->command_name); + ADD_ASSOC_STRING(&retval, "databaseName", intern->database_name); if (!php_phongo_bson_to_zval_ex(intern->command, &command_state)) { zval_ptr_dtor(&command_state.zchild); @@ -214,9 +239,6 @@ static HashTable* php_phongo_commandstartedevent_get_debug_info(phongo_compat_ob ADD_ASSOC_ZVAL(&retval, "command", &command_state.zchild); - ADD_ASSOC_STRING(&retval, "commandName", intern->command_name); - ADD_ASSOC_STRING(&retval, "databaseName", intern->database_name); - snprintf(operation_id, sizeof(operation_id), "%" PRId64, intern->operation_id); ADD_ASSOC_STRING(&retval, "operationId", operation_id); diff --git a/src/MongoDB/Monitoring/CommandStartedEvent.stub.php b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php index c3dbf3718..f0ce09513 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandStartedEvent.stub.php @@ -17,10 +17,15 @@ final public function getCommandName(): string {} final public function getDatabaseName(): string {} + final public function getHost(): string {} + final public function getOperationId(): string {} + final public function getPort(): int {} + final public function getRequestId(): string {} + /** @deprecated */ final public function getServer(): \MongoDB\Driver\Server {} final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} diff --git a/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h b/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h index f52bb79e1..34d7bd51c 100644 --- a/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 4ff134c852d47ac645fcc505d3b9319eb46a3899 */ + * Stub hash: be9f02816a4b44d256cb139d12c55cc9ac5d15e5 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -12,8 +12,13 @@ ZEND_END_ARG_INFO() #define arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getDatabaseName arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getCommandName +#define arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getHost arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getCommandName + #define arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getOperationId arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getCommandName +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getPort, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + #define arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getRequestId arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getCommandName ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getServer, 0, 0, MongoDB\\Driver\\Server, 0) @@ -30,7 +35,9 @@ static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, __construct); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getCommand); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getCommandName); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getDatabaseName); +static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getHost); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getOperationId); +static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getPort); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getRequestId); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getServer); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandStartedEvent, getServiceId); @@ -42,9 +49,11 @@ static const zend_function_entry class_MongoDB_Driver_Monitoring_CommandStartedE ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getCommand, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getCommand, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getCommandName, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getCommandName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getDatabaseName, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getDatabaseName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getHost, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getHost, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getOperationId, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getOperationId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getPort, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getPort, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getRequestId, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getRequestId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getServer, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getServer, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL|ZEND_ACC_DEPRECATED) ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getServiceId, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getServiceId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandStartedEvent, getServerConnectionId, arginfo_class_MongoDB_Driver_Monitoring_CommandStartedEvent_getServerConnectionId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent.c b/src/MongoDB/Monitoring/CommandSucceededEvent.c index e635850a1..eb1c4201c 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent.c +++ b/src/MongoDB/Monitoring/CommandSucceededEvent.c @@ -67,6 +67,16 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getDurationMi RETURN_LONG(intern->duration_micros); } +/* Returns this event's host */ +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getHost) +{ + php_phongo_commandsucceededevent_t* intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis()); + + PHONGO_PARSE_PARAMETERS_NONE(); + + RETVAL_STRING(intern->host.host); +} + /* Returns the event's operation ID */ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getOperationId) { @@ -81,6 +91,16 @@ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getOperationI RETVAL_STRING(operation_id); } +/* Returns this event's port */ +static PHP_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getPort) +{ + php_phongo_commandsucceededevent_t* intern = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(getThis()); + + PHONGO_PARSE_PARAMETERS_NONE(); + + RETVAL_LONG(intern->host.port); +} + /* Returns the reply document associated with the event */ static PHP_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getReply) { @@ -217,14 +237,13 @@ static HashTable* php_phongo_commandsucceededevent_get_debug_info(phongo_compat_ intern = Z_OBJ_COMMANDSUCCEEDEDEVENT(PHONGO_COMPAT_GET_OBJ(object)); *is_temp = 1; - array_init_size(&retval, 6); + array_init_size(&retval, 10); + ADD_ASSOC_STRING(&retval, "host", intern->host.host); + ADD_ASSOC_LONG_EX(&retval, "port", intern->host.port); ADD_ASSOC_STRING(&retval, "commandName", intern->command_name); ADD_ASSOC_INT64(&retval, "durationMicros", intern->duration_micros); - snprintf(operation_id, sizeof(operation_id), "%" PRId64, intern->operation_id); - ADD_ASSOC_STRING(&retval, "operationId", operation_id); - if (!php_phongo_bson_to_zval_ex(intern->reply, &reply_state)) { zval_ptr_dtor(&reply_state.zchild); goto done; @@ -232,6 +251,9 @@ static HashTable* php_phongo_commandsucceededevent_get_debug_info(phongo_compat_ ADD_ASSOC_ZVAL(&retval, "reply", &reply_state.zchild); + snprintf(operation_id, sizeof(operation_id), "%" PRId64, intern->operation_id); + ADD_ASSOC_STRING(&retval, "operationId", operation_id); + snprintf(request_id, sizeof(request_id), "%" PRId64, intern->request_id); ADD_ASSOC_STRING(&retval, "requestId", request_id); diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php index e671c06b6..4f2ec888a 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php +++ b/src/MongoDB/Monitoring/CommandSucceededEvent.stub.php @@ -17,12 +17,17 @@ final public function getDatabaseName(): string {} final public function getDurationMicros(): int {} + final public function getHost(): string {} + final public function getOperationId(): string {} + final public function getPort(): int {} + final public function getReply(): object {} final public function getRequestId(): string {} + /** @deprecated */ final public function getServer(): \MongoDB\Driver\Server {} final public function getServiceId(): ?\MongoDB\BSON\ObjectId {} diff --git a/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h b/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h index 8ccdb3bb5..047fdcf8f 100644 --- a/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h +++ b/src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 86e4fd7aeffe8b4d03c32f4221450d80b3f322a9 */ + * Stub hash: c29b3eb0f340867cc1707b29e935f42fdbc0f031 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent___construct, 0, 0, 0) ZEND_END_ARG_INFO() @@ -12,8 +12,12 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getDurationMicros, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() +#define arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getHost arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getCommandName + #define arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getOperationId arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getCommandName +#define arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getPort arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getDurationMicros + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getReply, 0, 0, IS_OBJECT, 0) ZEND_END_ARG_INFO() @@ -33,7 +37,9 @@ static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, __construct) static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getCommandName); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getDatabaseName); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getDurationMicros); +static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getHost); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getOperationId); +static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getPort); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getReply); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getRequestId); static ZEND_METHOD(MongoDB_Driver_Monitoring_CommandSucceededEvent, getServer); @@ -46,10 +52,12 @@ static const zend_function_entry class_MongoDB_Driver_Monitoring_CommandSucceede ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getCommandName, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getCommandName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getDatabaseName, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getDatabaseName, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getDurationMicros, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getDurationMicros, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getHost, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getHost, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getOperationId, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getOperationId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getPort, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getPort, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getReply, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getReply, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getRequestId, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getRequestId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getServer, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) + ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getServer, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getServer, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL|ZEND_ACC_DEPRECATED) ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getServiceId, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getServiceId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(MongoDB_Driver_Monitoring_CommandSucceededEvent, getServerConnectionId, arginfo_class_MongoDB_Driver_Monitoring_CommandSucceededEvent_getServerConnectionId, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_FE_END diff --git a/src/phongo_apm.c b/src/phongo_apm.c index b0c3d1a6c..0f622d002 100644 --- a/src/phongo_apm.c +++ b/src/phongo_apm.c @@ -143,6 +143,8 @@ static void phongo_apm_command_started(const mongoc_apm_command_started_t* event object_init_ex(&z_event, php_phongo_commandstartedevent_ce); p_event = Z_COMMANDSTARTEDEVENT_OBJ_P(&z_event); + memcpy(&p_event->host, mongoc_apm_command_started_get_host(event), sizeof(mongoc_host_list_t)); + p_event->command_name = estrdup(mongoc_apm_command_started_get_command_name(event)); p_event->database_name = estrdup(mongoc_apm_command_started_get_database_name(event)); p_event->server_id = mongoc_apm_command_started_get_server_id(event); @@ -189,6 +191,8 @@ static void phongo_apm_command_succeeded(const mongoc_apm_command_succeeded_t* e object_init_ex(&z_event, php_phongo_commandsucceededevent_ce); p_event = Z_COMMANDSUCCEEDEDEVENT_OBJ_P(&z_event); + memcpy(&p_event->host, mongoc_apm_command_succeeded_get_host(event), sizeof(mongoc_host_list_t)); + p_event->command_name = estrdup(mongoc_apm_command_succeeded_get_command_name(event)); p_event->database_name = estrdup(mongoc_apm_command_succeeded_get_database_name(event)); p_event->server_id = mongoc_apm_command_succeeded_get_server_id(event); @@ -237,6 +241,8 @@ static void phongo_apm_command_failed(const mongoc_apm_command_failed_t* event) object_init_ex(&z_event, php_phongo_commandfailedevent_ce); p_event = Z_COMMANDFAILEDEVENT_OBJ_P(&z_event); + memcpy(&p_event->host, mongoc_apm_command_failed_get_host(event), sizeof(mongoc_host_list_t)); + p_event->command_name = estrdup(mongoc_apm_command_failed_get_command_name(event)); p_event->database_name = estrdup(mongoc_apm_command_failed_get_database_name(event)); p_event->server_id = mongoc_apm_command_failed_get_server_id(event); diff --git a/src/phongo_structs.h b/src/phongo_structs.h index 3c0979438..da3eb5ab2 100644 --- a/src/phongo_structs.h +++ b/src/phongo_structs.h @@ -281,47 +281,50 @@ typedef struct { } php_phongo_utcdatetime_t; typedef struct { - zval manager; - char* command_name; - char* database_name; - uint32_t server_id; - int64_t operation_id; - int64_t request_id; - int64_t duration_micros; - bson_t* reply; - zval z_error; - bool has_service_id; - bson_oid_t service_id; - int64_t server_connection_id; + zval manager; + char* command_name; + char* database_name; + uint32_t server_id; + int64_t operation_id; + int64_t request_id; + int64_t duration_micros; + bson_t* reply; + zval z_error; + bool has_service_id; + bson_oid_t service_id; + int64_t server_connection_id; + mongoc_host_list_t host; zend_object std; } php_phongo_commandfailedevent_t; typedef struct { - zval manager; - char* command_name; - char* database_name; - uint32_t server_id; - int64_t operation_id; - int64_t request_id; - bson_t* command; - bool has_service_id; - bson_oid_t service_id; - int64_t server_connection_id; + zval manager; + char* command_name; + char* database_name; + uint32_t server_id; + int64_t operation_id; + int64_t request_id; + bson_t* command; + bool has_service_id; + bson_oid_t service_id; + int64_t server_connection_id; + mongoc_host_list_t host; zend_object std; } php_phongo_commandstartedevent_t; typedef struct { - zval manager; - char* command_name; - char* database_name; - uint32_t server_id; - int64_t operation_id; - int64_t request_id; - int64_t duration_micros; - bson_t* reply; - bool has_service_id; - bson_oid_t service_id; - int64_t server_connection_id; + zval manager; + char* command_name; + char* database_name; + uint32_t server_id; + int64_t operation_id; + int64_t request_id; + int64_t duration_micros; + bson_t* reply; + bool has_service_id; + bson_oid_t service_id; + int64_t server_connection_id; + mongoc_host_list_t host; zend_object std; } php_phongo_commandsucceededevent_t; diff --git a/tests/apm/commandFailedEvent-001.phpt b/tests/apm/commandFailedEvent-001.phpt index 14b409a9b..f45c08821 100644 --- a/tests/apm/commandFailedEvent-001.phpt +++ b/tests/apm/commandFailedEvent-001.phpt @@ -31,7 +31,9 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($event->getDurationMicros()); echo "getDurationMicros() returns > 0: ", $event->getDurationMicros() > 0 ? 'yes' : 'no', "\n"; var_dump($event->getError() instanceof MongoDB\Driver\Exception\Exception); + var_dump($event->getHost()); var_dump($event->getOperationId()); + var_dump($event->getPort()); var_dump($event->getReply()); var_dump($event->getRequestId()); var_dump($event->getServer()); @@ -60,11 +62,15 @@ string(5) "admin" int(%d) getDurationMicros() returns > 0: yes bool(true) +string(%d) "%s" string(%d) "%d" +int(%d) object(stdClass)#%d (%d) { %A } string(%d) "%d" + +Deprecated: Method MongoDB\Driver\Monitoring\CommandFailedEvent::getServer() is deprecated in %s object(MongoDB\Driver\Server)#%d (%d) { %A } diff --git a/tests/apm/commandFailedEvent-debug-001.phpt b/tests/apm/commandFailedEvent-debug-001.phpt index ba8383b3b..a1647d352 100644 --- a/tests/apm/commandFailedEvent-debug-001.phpt +++ b/tests/apm/commandFailedEvent-debug-001.phpt @@ -42,6 +42,10 @@ throws(function() use ($manager, $command) { --EXPECTF-- object(MongoDB\Driver\Monitoring\CommandFailedEvent)#%d (%d) { + ["host"]=> + string(%d) "%s" + ["port"]=> + int(%d) ["commandName"]=> string(9) "aggregate" ["durationMicros"]=> @@ -49,11 +53,11 @@ object(MongoDB\Driver\Monitoring\CommandFailedEvent)#%d (%d) { ["error"]=> object(MongoDB\Driver\Exception\ServerException)#%d (%d) {%A } - ["operationId"]=> - string(%d) "%d" ["reply"]=> object(stdClass)#%d (%d) {%A } + ["operationId"]=> + string(%d) "%d" ["requestId"]=> string(%d) "%d" ["server"]=> diff --git a/tests/apm/commandStartedEvent-001.phpt b/tests/apm/commandStartedEvent-001.phpt index 4c240cbe5..1c076f78e 100644 --- a/tests/apm/commandStartedEvent-001.phpt +++ b/tests/apm/commandStartedEvent-001.phpt @@ -15,7 +15,9 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($event->getCommand()); var_dump($event->getCommandName()); var_dump($event->getDatabaseName()); + var_dump($event->getHost()); var_dump($event->getOperationId()); + var_dump($event->getPort()); var_dump($event->getRequestId()); var_dump($event->getServer()); @@ -47,8 +49,12 @@ object(stdClass)#%d (%d) { } string(4) "ping" string(5) "admin" +string(%d) "%s" string(%d) "%d" +int(%d) string(%d) "%d" + +Deprecated: Method MongoDB\Driver\Monitoring\CommandStartedEvent::getServer() is deprecated in %s object(MongoDB\Driver\Server)#%d (%d) { %A } diff --git a/tests/apm/commandStartedEvent-debug-001.phpt b/tests/apm/commandStartedEvent-debug-001.phpt index b9b090554..3923f030b 100644 --- a/tests/apm/commandStartedEvent-debug-001.phpt +++ b/tests/apm/commandStartedEvent-debug-001.phpt @@ -33,13 +33,17 @@ $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1] --EXPECTF-- object(MongoDB\Driver\Monitoring\CommandStartedEvent)#%d (%d) { - ["command"]=> - object(stdClass)#%d (%d) {%A - } + ["host"]=> + string(%d) "%s" + ["port"]=> + int(%d) ["commandName"]=> string(4) "ping" ["databaseName"]=> string(%d) "%s" + ["command"]=> + object(stdClass)#%d (%d) {%A + } ["operationId"]=> string(%d) "%d" ["requestId"]=> diff --git a/tests/apm/commandSucceededEvent-001.phpt b/tests/apm/commandSucceededEvent-001.phpt index c502dac4d..c445d8e27 100644 --- a/tests/apm/commandSucceededEvent-001.phpt +++ b/tests/apm/commandSucceededEvent-001.phpt @@ -28,7 +28,9 @@ class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber var_dump($event->getDatabaseName()); var_dump($event->getDurationMicros()); echo "getDurationMicros() returns > 0: ", $event->getDurationMicros() > 0 ? 'yes' : 'no', "\n"; + var_dump($event->getHost()); var_dump($event->getOperationId()); + var_dump($event->getPort()); var_dump($event->getReply()); var_dump($event->getRequestId()); var_dump($event->getServer()); @@ -56,11 +58,15 @@ string(4) "ping" string(5) "admin" int(%d) getDurationMicros() returns > 0: yes +string(%d) "%s" string(%d) "%d" +int(%d) object(stdClass)#%d (%d) { %A } string(%d) "%d" + +Deprecated: Method MongoDB\Driver\Monitoring\CommandSucceededEvent::getServer() is deprecated in %s object(MongoDB\Driver\Server)#%d (%d) { %A } diff --git a/tests/apm/commandSucceededEvent-debug-001.phpt b/tests/apm/commandSucceededEvent-debug-001.phpt index 361d2be23..696a76b52 100644 --- a/tests/apm/commandSucceededEvent-debug-001.phpt +++ b/tests/apm/commandSucceededEvent-debug-001.phpt @@ -33,15 +33,19 @@ $manager->executeCommand(DATABASE_NAME, new MongoDB\Driver\Command(['ping' => 1] --EXPECTF-- object(MongoDB\Driver\Monitoring\CommandSucceededEvent)#%d (%d) { + ["host"]=> + string(%d) "%s" + ["port"]=> + int(%d) ["commandName"]=> string(4) "ping" ["durationMicros"]=> int(%d) - ["operationId"]=> - string(%d) "%d" ["reply"]=> object(stdClass)#%d (%d) {%A } + ["operationId"]=> + string(%d) "%d" ["requestId"]=> string(%d) "%d" ["server"]=>