Skip to content

Commit

Permalink
http.status_code >= 400 记录 http.response.body
Browse files Browse the repository at this point in the history
  • Loading branch information
kilingzhang committed Aug 30, 2022
1 parent 54b9aca commit a34f220
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 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.5.1" /* Replace with version number for your extension */
#define PHP_OPENTELEMETRY_VERSION "0.5.2" /* 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
5 changes: 3 additions & 2 deletions src/zend_hook_curl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,10 @@ void opentelemetry_curl_exec_handler(INTERNAL_FUNCTION_PARAMETERS) {
zval_dtor(&args[0]);
zval_dtor(&curl_error);
} else if (Z_LVAL_P(response_http_code) >= 400) {
Provider::errorEnd(span, Z_STR_P(return_value)->val);
set_string_attribute(span->add_attributes(), "http.response.body", Z_STRVAL_P(return_value));
Provider::errorEnd(span, Z_STRVAL_P(return_value));
} else if (Z_LVAL_P(response_http_code) == 200) {
set_string_attribute(span->add_attributes(), "http.response.body", Z_STR_P(return_value)->val);
set_string_attribute(span->add_attributes(), "http.response.body", Z_STRVAL_P(return_value));
}

zval_dtor(&url_response);
Expand Down

0 comments on commit a34f220

Please sign in to comment.