Skip to content

Commit

Permalink
fix # core
Browse files Browse the repository at this point in the history
  • Loading branch information
kilingzhang committed Aug 26, 2022
1 parent 45165ca commit ceeb9fc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion php_opentelemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ OPENTELEMETRY_BEGIN_EXTERN_C()
extern zend_module_entry opentelemetry_module_entry;
#define phpext_opentelemetry_ptr &opentelemetry_module_entry

#define PHP_OPENTELEMETRY_VERSION "0.4.0" /* Replace with version number for your extension */
#define PHP_OPENTELEMETRY_VERSION "0.5.0" /* Replace with version number for your extension */
#define DEFAULT_ETH_INF "eth0"
#define PHP_OPENTELEMETRY_SERVICE_NAME "opentelemetry"
#define PHP_OPENTELEMETRY_SERVICE_NAME_KEY "SERVICE_NAME"
Expand Down
6 changes: 6 additions & 0 deletions src/core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ void opentelemetry_module_shutdown() {
// 注销hook
unregister_zend_hook();
OPENTELEMETRY_G(ipv4).shrink_to_fit();

// debug 专用
// // 用户自定义函数执行器(php脚本定义的类、函数)
// zend_execute_ex = opentelemetry_original_zend_execute_ex;
// // 内部函数执行器(c语言定义的类、函数)
// zend_execute_internal = opentelemetry_original_zend_execute_internal;
}

void opentelemetry_request_init() {
Expand Down
11 changes: 3 additions & 8 deletions src/zend_hook_memcached.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ void opentelemetry_memcached_handler(INTERNAL_FUNCTION_PARAMETERS) {
zval server;
zval params[1];
ZVAL_STRING(&params[0], str.c_str());
zend_call_method_with_1_params(
obj, Z_OBJCE_P(self), nullptr, "getserverbykey", &server, &params[0]);
zend_call_method_with_1_params(obj, Z_OBJCE_P(self), nullptr, "getserverbykey", &server, params);

if (!Z_ISUNDEF(server) && Z_TYPE(server) == IS_ARRAY) {
zval *str_zval;
Expand All @@ -105,9 +104,7 @@ void opentelemetry_memcached_handler(INTERNAL_FUNCTION_PARAMETERS) {
host.shrink_to_fit();

zval_dtor(str_zval);
efree(str_zval);
}
if (!Z_ISUNDEF(server)) {
// efree(str_zval);
zval_dtor(&server);
}
}
Expand Down Expand Up @@ -157,9 +154,7 @@ void opentelemetry_memcached_handler(INTERNAL_FUNCTION_PARAMETERS) {
} else {
Provider::errorEnd(span, result);
}
if (!Z_ISUNDEF(zval_result)) {
zval_dtor(&zval_result);
}
zval_dtor(&zval_result);
} else {
Provider::errorEnd(span, "UN_KNOW");
}
Expand Down

0 comments on commit ceeb9fc

Please sign in to comment.