Skip to content

Commit

Permalink
Merge pull request #884 from newrelic/dev
Browse files Browse the repository at this point in the history
Release 10.20
  • Loading branch information
lavarou authored Apr 29, 2024
2 parents 2c9bf20 + 85d74db commit 4f470da
Show file tree
Hide file tree
Showing 167 changed files with 2,994 additions and 111 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/bug-report-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2020 New Relic Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: bug-report-response

on:
issues:
types:
- labeled

jobs:
bug-report-response:
if: github.event.label.name == 'bug' && github.event.issue.state == 'open'
uses: ./.github/workflows/issue-comment.yml
with:
issue-number: ${{ github.event.issue.number }}
message: >
Thank you for your issue report. A member of the New Relic PHP Agent Team
will review your report and endeavor to respond in a timely manner.
Need troubleshooting help? Please review some of our common troubleshooting documentation, starting with [generating debug logs](https://docs.newrelic.com/docs/apm/agents/php-agent/troubleshooting/generating-logs-troubleshooting-php/).
From there, additional resources and tips are available in our troubleshooting section, accessible from the left-hand panel of our documentation site. Additionally, please be sure to visit
our [Explorer's Hub](https://forum.newrelic.com/s/), where other members of the community may have solved an issue similar to yours with the help of our Support team members.
Have a question regarding support for an Operating System, PHP Version, Framework, or Library?
Please take a look at our [Compatibility Docs](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/php-agent-compatibility-requirements/).
Binary support for ARM-based CPU architecture is now available via the [tarball installation](https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-arm64/#tarball-installation) method for PHP Versions 8.0+!
General installation instructions can be found on our [Installation Overview](https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-overview/) page.
Need more information about an Agent INI setting? Our [Configuration](https://docs.newrelic.com/docs/apm/agents/php-agent/configuration/php-agent-configuration/)
page contains an explanation for each INI setting and how to modify the defaults.
Looking for something else? All New Relic PHP Agent Documentation can be found under our [Introduction](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/) page.
25 changes: 25 additions & 0 deletions .github/workflows/issue-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 New Relic Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: issue-comment

on:
workflow_call:
inputs:
issue-number:
type: number
required: true
message:
type: string
required: true

jobs:
post-comment:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.ISSUE_BOT_TOKEN }}
steps:
- name: respond to issue
run: |
gh issue comment ${{ inputs.issue-number }} --body ${{ inputs.message }}
28 changes: 28 additions & 0 deletions .github/workflows/issue-support-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2020 New Relic Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#

name: issue-support-label

on:
issues:
types:
- labeled

jobs:
support-response:
if: github.event.label.name == 'support' && github.event.issue.state == 'open'
uses: ./.github/workflows/issue-comment.yml
with:
issue-number: ${{ github.event.issue.number }}
message: >
This issue has been identified as requiring additional information to debug.
Due to the potentially sensitive nature of the information we may have to collect,
such as PHPInfo and Debug Logs, please follow [these steps](https://docs.newrelic.com/docs/new-relic-solutions/solve-common-issues/find-help-use-support-portal/#file-ticket)
to create a support case, where a member of our New Relic Support Team will work
with you to gather the necessary information securely and help debug your issue.
If your subscription level does not include technical support, the
other option available to customers is to use New Relic’s community support channel: [Explorers Hub](https://forum.newrelic.com/s/). From there, a member of our New Relic Support Team will work
with you to gather the necessary information securely and help debug your issue.
For all available options on how to get support, please see [these resources](https://docs.newrelic.com/docs/new-relic-solutions/solve-common-issues/find-help-use-support-portal/).
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
10.19.0
10.20.0
10 changes: 8 additions & 2 deletions agent/fw_drupal8.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "util_memory.h"
#include "util_strings.h"

#define PHP_PACKAGE_NAME "drupal/core"

/*
* Purpose : Convenience function to handle adding a callback to a method,
* given a class entry and a method name. This will check the
Expand Down Expand Up @@ -684,7 +686,11 @@ void nr_drupal_version() {
// Add php package to transaction
if (nr_php_is_zval_valid_string(zval_version)) {
char* version = Z_STRVAL_P(zval_version);
nr_txn_add_php_package(NRPRG(txn), "drupal/core", version);
if (NRINI(vulnerability_management_package_detection_enabled)) {
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
}
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
version);
}

nr_php_zval_free(&zval_version);
Expand Down Expand Up @@ -753,7 +759,7 @@ void nr_drupal8_enable(TSRMLS_D) {
}

if (NRINI(vulnerability_management_package_detection_enabled)) {
nr_txn_add_php_package(NRPRG(txn), "drupal/core",
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME,
PHP_PACKAGE_VERSION_UNKNOWN);
}
}
3 changes: 2 additions & 1 deletion agent/fw_hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ extern void nr_symfony4_enable(TSRMLS_D);
extern void nr_silex_enable(TSRMLS_D);
extern void nr_slim_enable(TSRMLS_D);
extern void nr_wordpress_enable(TSRMLS_D);
extern void nr_yii_enable(TSRMLS_D);
extern void nr_yii1_enable(TSRMLS_D);
extern void nr_yii2_enable(TSRMLS_D);
extern void nr_zend_enable(TSRMLS_D);
extern void nr_fw_zend2_enable(TSRMLS_D);

Expand Down
6 changes: 5 additions & 1 deletion agent/fw_laravel.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#include "ext/standard/php_versioning.h"
#include "Zend/zend_exceptions.h"

#define PHP_PACKAGE_NAME "laravel/framework"

/*
* This instruments Laravel 4.0-5.0, inclusive.
* There is no support for Laravel 3.X or earlier.
Expand Down Expand Up @@ -959,8 +961,10 @@ NR_PHP_WRAPPER(nr_laravel_application_construct) {

if (NRINI(vulnerability_management_package_detection_enabled)) {
// Add php package to transaction
nr_txn_add_php_package(NRPRG(txn), "laravel/framework", version);
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
}
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
version);

if (version) {
nrl_debug(NRL_FRAMEWORK, "Laravel version is " NRP_FMT, NRP_PHP(version));
Expand Down
25 changes: 15 additions & 10 deletions agent/fw_slim.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "fw_support.h"
#include "util_logging.h"

#define PHP_PACKAGE_NAME "slim/slim"

static char* nr_slim_path_from_route(zval* route TSRMLS_DC) {
zval* name = NULL;
zval* pattern = NULL;
Expand Down Expand Up @@ -119,8 +121,13 @@ NR_PHP_WRAPPER(nr_slim_application_construct) {

version = nr_php_get_object_constant(this_var, "VERSION");

// Add php package to transaction
nr_txn_add_php_package(NRPRG(txn), "slim/slim", version);
if (NRINI(vulnerability_management_package_detection_enabled)) {
// Add php package to transaction
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
}

nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
version);

nr_free(version);
nr_php_scope_release(&this_var);
Expand All @@ -139,13 +146,11 @@ void nr_slim_enable(TSRMLS_D) {
nr_php_wrap_user_function(NR_PSTR("Slim\\Routing\\Route::run"),
nr_slim3_4_route_run TSRMLS_CC);

if (NRINI(vulnerability_management_package_detection_enabled)) {
/* Slim 2 does not have the same path as Slim 3/4 which is why
we need to separate these*/
nr_php_wrap_user_function(NR_PSTR("Slim\\Slim::__construct"),
nr_slim_application_construct);
/* Slim 2 does not have the same path as Slim 3/4 which is why
we need to separate these*/
nr_php_wrap_user_function(NR_PSTR("Slim\\Slim::__construct"),
nr_slim_application_construct);

nr_php_wrap_user_function(NR_PSTR("Slim\\App::__construct"),
nr_slim_application_construct);
}
nr_php_wrap_user_function(NR_PSTR("Slim\\App::__construct"),
nr_slim_application_construct);
}
35 changes: 35 additions & 0 deletions agent/fw_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "util_memory.h"
#include "util_strings.h"

#define MAJOR_VERSION_LENGTH 8

void nr_php_framework_add_supportability_metric(const char* framework_name,
const char* name TSRMLS_DC) {
char buf[512];
Expand Down Expand Up @@ -52,3 +54,36 @@ void nr_fw_support_add_logging_supportability_metric(nrtxn_t* txn,
nrm_force_add(txn->unscoped_metrics, metname, 0);
nr_free(metname);
}

void nr_fw_support_add_package_supportability_metric(
nrtxn_t* txn,
const char* package_name,
const char* package_version) {
if (NULL == txn || NULL == package_name || NULL == package_version) {
return;
}

char* metname = NULL;
char major_version[MAJOR_VERSION_LENGTH] = {0};

/* The below for loop checks if the major version of the package is more than
* one digit and keeps looping until a '.' is encountered or one of the
* conditions is met.
*/
for (int i = 0; package_version[i] && i < MAJOR_VERSION_LENGTH - 1; i++) {
if ('.' == package_version[i]) {
break;
}
major_version[i] = package_version[i];
}

if (NR_FW_UNSET == NRINI(force_framework)) {
metname = nr_formatf("Supportability/PHP/package/%s/%s/detected",
package_name, major_version);
} else {
metname = nr_formatf("Supportability/PHP/package/%s/%s/forced",
package_name, major_version);
}
nrm_force_add(txn->unscoped_metrics, metname, 0);
nr_free(metname);
}
13 changes: 13 additions & 0 deletions agent/fw_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@ extern void nr_fw_support_add_logging_supportability_metric(
const char* library_name,
const bool is_enabled);

/*
* Purpose: Add 'Supportability/PHP/package/{package}/{version}/detected' metric
*
* Params : 1. Transaction object
* 2. Package name
* 3. Package version
*
*/
extern void nr_fw_support_add_package_supportability_metric(
nrtxn_t* txn,
const char* package_name,
const char* package_version);

#endif /* FW_SUPPORT_HDR */
9 changes: 7 additions & 2 deletions agent/fw_wordpress.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#define NR_WORDPRESS_HOOK_PREFIX "Framework/WordPress/Hook/"
#define NR_WORDPRESS_PLUGIN_PREFIX "Framework/WordPress/Plugin/"
#define PHP_PACKAGE_NAME "wordpress"

static nr_regex_t* wordpress_hook_regex;

Expand Down Expand Up @@ -809,7 +810,11 @@ void nr_wordpress_version() {
if (SUCCESS == result) {
if (nr_php_is_zval_valid_string(&retval)) {
char* version = Z_STRVAL(retval);
nr_txn_add_php_package(NRPRG(txn), "wordpress", version);
if (NRINI(vulnerability_management_package_detection_enabled)) {
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME, version);
}
nr_fw_support_add_package_supportability_metric(NRPRG(txn), PHP_PACKAGE_NAME,
version);
}
zval_dtor(&retval);
}
Expand Down Expand Up @@ -865,7 +870,7 @@ void nr_wordpress_enable(TSRMLS_D) {
#endif /* OAPI */

if (NRINI(vulnerability_management_package_detection_enabled)) {
nr_txn_add_php_package(NRPRG(txn), "wordpress",
nr_txn_add_php_package(NRPRG(txn), PHP_PACKAGE_NAME,
PHP_PACKAGE_VERSION_UNKNOWN);
}
}
Expand Down
Loading

0 comments on commit 4f470da

Please sign in to comment.