Skip to content

Commit

Permalink
Merge pull request #898 from newrelic/dev
Browse files Browse the repository at this point in the history
Release 10.21
  • Loading branch information
ZNeumann authored May 17, 2024
2 parents ca8f7ff + 42136bb commit ddc5230
Show file tree
Hide file tree
Showing 34 changed files with 1,834 additions and 114 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/code-coverage-baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
-v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent"
$IMAGE_NAME:$IMAGE_TAG-${{ matrix.platform }}-$IMAGE_VERSION daemon_test
- name: Save integration_runner for integration tests
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: integration_runner-${{matrix.platform}}-${{matrix.arch}}
path: php-agent/bin/integration_runner
Expand Down Expand Up @@ -124,19 +124,19 @@ jobs:
-e ENABLE_COVERAGE=${{matrix.codecov}}
$IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make agent-check
- name: Save newrelic.so for integration tests
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: newrelic.so-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/modules/newrelic.so
- name: Save axiom gcov data files (*.gcno, *.gcna)
if: ${{ matrix.codecov == 1 }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: axiom.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/axiom/*.gc*
- name: Save agent gcov data files (*.gcno, *.gcna)
if: ${{ matrix.codecov == 1 }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: agent.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/.libs/*.gc*
Expand All @@ -161,24 +161,24 @@ jobs:
repository: ${{ inputs.origin }}/newrelic-php-agent
ref: ${{ inputs.ref }}
- name: Get integration_runner
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: integration_runner-${{matrix.platform}}-${{matrix.arch}}
path: php-agent/bin
- name: Get newrelic.so
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: newrelic.so-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/modules
- name: Get axiom gcov data files
if: ${{ matrix.codecov == 1 }}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: axiom.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/axiom
- name: Get agent gcov data files
if: ${{ matrix.codecov == 1 }}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: agent.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/.libs
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,20 @@ jobs:
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: manual
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Build
run: |
make ${{ matrix.language == 'go' && 'daemon' || 'agent' }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/make-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
-v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent"
$IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make agent
- name: Save newrelic.so for integration tests
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: newrelic.so-${{matrix.platform}}-${{inputs.arch}}-${{matrix.php}}
path: php-agent/agent/modules/newrelic.so
2 changes: 1 addition & 1 deletion .github/workflows/make-for-platform-on-arch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
-e APP_supportability=${{secrets.APP_SUPPORTABILITY}}
$IMAGE_NAME:$IMAGE_TAG-${{ matrix.platform }}-$IMAGE_VERSION ${{inputs.make-target}}
- name: Save ${{inputs.make-target}} artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{inputs.artifact-name}}-${{matrix.platform}}-${{inputs.arch}}
path: php-agent/${{ inputs.artifact-pattern }}
4 changes: 2 additions & 2 deletions .github/workflows/make-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ jobs:
repository: ${{ inputs.origin }}/newrelic-php-agent
ref: ${{ inputs.ref }}
- name: Get integration_runner
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: integration_runner-${{matrix.platform}}-${{inputs.arch}}
path: php-agent/bin
- name: Get newrelic.so
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: newrelic.so-${{matrix.platform}}-${{inputs.arch}}-${{matrix.php}}
path: php-agent/agent/modules
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ jobs:
-e BUILD_NUMBER=${{inputs.build-number}}
$IMAGE_NAME:$IMAGE_TAG-${{ matrix.platform }}-$IMAGE_VERSION release-daemon
- name: Save build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: newrelic-php-agent/releases
name: release-from-gha
name: release-from-gha-${{ matrix.platform }}-${{ matrix.arch }}
if-no-files-found: error
agent_release:
env:
Expand Down Expand Up @@ -87,8 +87,8 @@ jobs:
-e BUILD_NUMBER=${{inputs.build-number}}
$IMAGE_NAME:agent-builder-php${{matrix.php_ver}}-${{matrix.platform}}-$IMAGE_VERSION release-${{matrix.php_ver}}-gha
- name: Save build artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: newrelic-php-agent/releases
name: release-from-gha
name: release-from-gha-${{ matrix.platform }}-${{ matrix.arch }}
if-no-files-found: error
16 changes: 8 additions & 8 deletions .github/workflows/test-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
-v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent"
$IMAGE_NAME:$IMAGE_TAG-${{ matrix.platform }}-$IMAGE_VERSION daemon_test
- name: Save integration_runner for integration tests
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: integration_runner-${{matrix.platform}}-${{matrix.arch}}
path: php-agent/bin/integration_runner
Expand Down Expand Up @@ -159,19 +159,19 @@ jobs:
-e ENABLE_COVERAGE=${{matrix.codecov}}
$IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make agent-${{ steps.get-check-variant.outputs.AGENT_CHECK_VARIANT }}
- name: Save newrelic.so for integration tests
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: newrelic.so-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/modules/newrelic.so
- name: Save axiom gcov data files (*.gcno, *.gcna)
if: ${{ matrix.codecov == 1 }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: axiom.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/axiom/*.gc*
- name: Save agent gcov data files (*.gcno, *.gcna)
if: ${{ matrix.codecov == 1 }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: agent.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/.libs/*.gc*
Expand Down Expand Up @@ -206,24 +206,24 @@ jobs:
with:
path: php-agent
- name: Get integration_runner
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: integration_runner-${{matrix.platform}}-${{matrix.arch}}
path: php-agent/bin
- name: Get newrelic.so
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: newrelic.so-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/modules
- name: Get axiom gcov data files
if: ${{ matrix.codecov == 1 }}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: axiom.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/axiom
- name: Get agent gcov data files
if: ${{ matrix.codecov == 1 }}
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: agent.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}}
path: php-agent/agent/.libs
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.20.0
10.21.0
72 changes: 40 additions & 32 deletions agent/lib_guzzle6.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,13 @@ static void nr_guzzle6_requesthandler_handle_response(zval* handler,
nr_segment_external_params_t external_params = {.library = "Guzzle 6"};
zval* request;
zval* method;
zval* status;
zval* status = NULL;

if (NR_FAILURE
== nr_guzzle_obj_find_and_remove(handler, &segment TSRMLS_CC)) {
return;
}

if (!nr_php_psr7_is_response(response TSRMLS_CC)) {
return;
}

request = nr_guzzle6_requesthandler_get_request(handler TSRMLS_CC);
if (NULL == request) {
return;
Expand All @@ -133,32 +129,34 @@ static void nr_guzzle6_requesthandler_handle_response(zval* handler,
return;
}

/*
* Get the X-NewRelic-App-Data response header. If there isn't one, NULL is
* returned, and everything still works just fine.
*/
external_params.encoded_response_header
= nr_php_psr7_message_get_header(response, X_NEWRELIC_APP_DATA TSRMLS_CC);

if (NRPRG(txn) && NRTXN(special_flags.debug_cat)) {
nrl_verbosedebug(
NRL_CAT, "CAT: outbound response: transport='Guzzle 6' %s=" NRP_FMT,
X_NEWRELIC_APP_DATA, NRP_CAT(external_params.encoded_response_header));
}

status = nr_php_call(response, "getStatusCode");

if (nr_php_is_zval_valid_integer(status)) {
external_params.status = Z_LVAL_P(status);
}

method = nr_php_call(request, "getMethod");

if (nr_php_is_zval_valid_string(method)) {
external_params.procedure
= nr_strndup(Z_STRVAL_P(method), Z_STRLEN_P(method));
}

if (NULL != response && nr_php_psr7_is_response(response TSRMLS_CC)) {
/*
* Get the X-NewRelic-App-Data response header. If there isn't one, NULL is
* returned, and everything still works just fine.
*/
external_params.encoded_response_header
= nr_php_psr7_message_get_header(response, X_NEWRELIC_APP_DATA TSRMLS_CC);

if (NRPRG(txn) && NRTXN(special_flags.debug_cat)) {
nrl_verbosedebug(
NRL_CAT, "CAT: outbound response: transport='Guzzle 6' %s=" NRP_FMT,
X_NEWRELIC_APP_DATA, NRP_CAT(external_params.encoded_response_header));
}

status = nr_php_call(response, "getStatusCode");

if (nr_php_is_zval_valid_integer(status)) {
external_params.status = Z_LVAL_P(status);
}
}

nr_segment_external_end(&segment, &external_params);

nr_free(external_params.encoded_response_header);
Expand Down Expand Up @@ -291,6 +289,12 @@ static PHP_NAMED_FUNCTION(nr_guzzle6_requesthandler_onrejected) {
return;
}

this_obj = NR_PHP_USER_FN_THIS();
if (NULL == this_obj) {
nrl_verbosedebug(NRL_FRAMEWORK, "%s: cannot obtain 'this'", __func__);
return;
}

/*
* See if this is an exception that we can get a response from. We're going
* to look for BadResponseException because, although it inherits from
Expand All @@ -305,6 +309,7 @@ static PHP_NAMED_FUNCTION(nr_guzzle6_requesthandler_onrejected) {
*/
if (!nr_php_object_instanceof_class(
exc, "GuzzleHttp\\Exception\\BadResponseException" TSRMLS_CC)) {
nr_guzzle6_requesthandler_handle_response(this_obj, NULL);
return;
}

Expand All @@ -314,12 +319,6 @@ static PHP_NAMED_FUNCTION(nr_guzzle6_requesthandler_onrejected) {
return;
}

this_obj = NR_PHP_USER_FN_THIS();
if (NULL == this_obj) {
nrl_verbosedebug(NRL_FRAMEWORK, "%s: cannot obtain 'this'", __func__);
return;
}

nr_guzzle6_requesthandler_handle_response(this_obj, response TSRMLS_CC);

nr_php_zval_free(&response);
Expand Down Expand Up @@ -448,6 +447,7 @@ void nr_guzzle6_enable(TSRMLS_D) {
"namespace newrelic\\Guzzle6;"

"use Psr\\Http\\Message\\RequestInterface;"
"use GuzzleHttp\\Promise\\PromiseInterface;"

"if (!function_exists('newrelic\\Guzzle6\\middleware')) {"
" function middleware(callable $handler) {"
Expand All @@ -468,8 +468,16 @@ void nr_guzzle6_enable(TSRMLS_D) {
*/
" $rh = new RequestHandler($request);"
" $promise = $handler($request, $options);"
" $promise->then([$rh, 'onFulfilled'], [$rh, 'onRejected']);"

" if (PromiseInterface::REJECTED == $promise->getState()) {"
/*
Special case for sync request. When sync requests is rejected,
onRejected callback is not called via `PromiseInterface::then`
and needs to be called manually.
*/
" $rh->onRejected($promise);"
" } else {"
" $promise->then([$rh, 'onFulfilled'], [$rh, 'onRejected']);"
" }"
" return $promise;"
" };"
" }"
Expand Down
6 changes: 0 additions & 6 deletions agent/php_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -2163,9 +2163,6 @@ void nr_php_observer_fcall_begin(zend_execute_data* execute_data) {
int show_executes = NR_PHP_PROCESS_GLOBALS(special_flags).show_executes;

if (nrunlikely(show_executes)) {
nrl_verbosedebug(NRL_AGENT,
"Stack depth: %d after OAPI function beginning via %s",
NRPRG(php_cur_stack_depth), __func__);
nr_php_show_exec(NR_EXECUTE_ORIG_ARGS);
}
nr_php_instrument_func_begin(NR_EXECUTE_ORIG_ARGS);
Expand All @@ -2191,9 +2188,6 @@ void nr_php_observer_fcall_end(zend_execute_data* execute_data,
= NR_PHP_PROCESS_GLOBALS(special_flags).show_execute_returns;

if (nrunlikely(show_executes_return)) {
nrl_verbosedebug(NRL_AGENT,
"Stack depth: %d before OAPI function exiting via %s",
NRPRG(php_cur_stack_depth), __func__);
nr_php_show_exec_return(NR_EXECUTE_ORIG_ARGS TSRMLS_CC);
}

Expand Down
4 changes: 2 additions & 2 deletions axiom/nr_version.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
/*
* Current version naming scheme is flowers
*
* allium 14Mar2022 (9.20)
* buttercup 26Apr2022 (9.21)
* cosmos 29Jun2022 (10.0)
* dahlia 19Sep2022 (10.1)
Expand All @@ -45,8 +44,9 @@
* tulip 21Feb2024 (10.17)
* ulmus 04Mar2024 (10.18)
* viburnum 18Mar2024 (10.19)
* wallflower 06May2024 (10.20)
*/
#define NR_CODENAME "wallflower"
#define NR_CODENAME "xerophyllum"

const char* nr_version(void) {
return NR_STR2(NR_VERSION);
Expand Down
Loading

0 comments on commit ddc5230

Please sign in to comment.