Skip to content

Commit

Permalink
Merge pull request #420 from newrelic/dev
Browse files Browse the repository at this point in the history
Release 9.21.0
  • Loading branch information
ZNeumann committed Apr 22, 2022
2 parents 952b9f1 + 90d8760 commit 96828fa
Show file tree
Hide file tree
Showing 403 changed files with 3,234 additions and 485 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
agent/configure.ac
agent/newrelic.map
agent/*.dep
axiom/tests
axiom/tests/*.tmp
bin/
pkg/

Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,32 +187,32 @@ DAEMON_TARGETS := $(addprefix bin/,client daemon integration_runner stressor)
.PHONY: daemon
daemon: go-minimum-version daemon-protobuf Makefile | bin/
@rm -rf $(DAEMON_TARGETS)
$(GO) install $(GOFLAGS) ./...
@$(GO) install $(GOFLAGS) ./...

# The -race flag enables the inegrated Go race detector. Output to stderr
.PHONY: daemon_race
daemon_race: go-minimum-version daemon-protobuf Makefile | bin/
@rm -rf $(DAEMON_TARGETS)
$(GO) install -race $(GOFLAGS) ./...
@$(GO) install -race $(GOFLAGS) ./...

.PHONY: daemon_test
daemon_test: go-minimum-version daemon-protobuf
$(GO) test $(GOFLAGS) ./...
@$(GO) test $(GOFLAGS) ./...

.PHONY: daemon_bench
daemon_bench: go-minimum-version daemon-protobuf
$(GO) test $(GOFLAGS) -bench=. ./...
@$(GO) test $(GOFLAGS) -bench=. ./...

.PHONY: daemon_integration
daemon_integration: go-minimum-version daemon-protobuf
$(MAKE) INTEGRATION_TAGS=1 go-minimum-version
$(GO) test $(GOFLAGS) ./...
@$(GO) test $(GOFLAGS) ./...

DAEMON_COV_FILE = daemon_coverage.out
.PHONY: daemon_cover
daemon_cover: go-minimum-version daemon-protobuf
@rm -f $(DAEMON_COV_FILE)
$(GO) test -coverprofile=$(DAEMON_COV_FILE) $(GOFLAGS) ./...
@$(GO) test -coverprofile=$(DAEMON_COV_FILE) $(GOFLAGS) ./...
$(GO) tool cover -html=$(DAEMON_COV_FILE)
@rm -f $(DAEMON_COV_FILE)

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.20.0
9.21.0
3 changes: 2 additions & 1 deletion agent/Makefile.frag
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ TEST_BINARIES = \
tests/test_api_datastore \
tests/test_api_distributed_trace \
tests/test_api_internal \
tests/test_api_metadata \
tests/test_api_metadata_dt_enabled \
tests/test_api_metadata_dt_disabled \
tests/test_call \
tests/test_curl \
tests/test_curl_md \
Expand Down
34 changes: 17 additions & 17 deletions agent/fw_laravel.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,34 +348,35 @@ static void nr_laravel_name_transaction(zval* router, zval* request TSRMLS_DC) {
route_name_zv = nr_php_call(route, "getName");
if (nr_php_is_zval_valid_string(route_name_zv)) {
const char generated_prefix[] = "generated::";
nr_string_len_t generated_prefix_len
= sizeof(generated_prefix) - 1;
nr_string_len_t generated_prefix_len = sizeof(generated_prefix) - 1;

if (nr_strncmp(generated_prefix, Z_STRVAL_P(route_name_zv), generated_prefix_len) != 0) {
char* route_name
= nr_strndup(Z_STRVAL_P(route_name_zv), Z_STRLEN_P(route_name_zv));
if (nr_strncmp(generated_prefix, Z_STRVAL_P(route_name_zv),
generated_prefix_len)
!= 0) {
char* route_name = nr_strndup(Z_STRVAL_P(route_name_zv),
Z_STRLEN_P(route_name_zv));

nrl_debug(NRL_FRAMEWORK,
"%s: using Route::getName() for transaction naming",
__func__);
nr_txn_set_path("Laravel", NRPRG(txn), route_name, NR_PATH_TYPE_ACTION,
NR_OK_TO_OVERWRITE);
nr_txn_set_path("Laravel", NRPRG(txn), route_name,
NR_PATH_TYPE_ACTION, NR_OK_TO_OVERWRITE);

nr_php_zval_free(&route_name_zv);
nr_free(route_name);
goto leave;
} else {
nrl_verbosedebug(
NRL_FRAMEWORK,
"%s: Route::getName() returned a randomly generated route name, skipping. ",
__func__);
nr_php_zval_free(&route_name_zv);
nrl_verbosedebug(NRL_FRAMEWORK,
"%s: Route::getName() returned a randomly generated "
"route name, skipping. ",
__func__);
nr_php_zval_free(&route_name_zv);
}
} else {
nrl_verbosedebug(
NRL_FRAMEWORK,
"%s: Route::getName() returned an unexpected value/type, skipping. ",
__func__);
nrl_verbosedebug(NRL_FRAMEWORK,
"%s: Route::getName() returned an unexpected "
"value/type, skipping. ",
__func__);
nr_php_zval_free(&route_name_zv);
}
}
Expand Down Expand Up @@ -1201,7 +1202,6 @@ void nr_laravel_enable(TSRMLS_D) {
nr_php_wrap_user_function(
NR_PSTR("Illuminate\\Routing\\RouteCollection::getRouteForMethods"),
nr_laravel_routes_get_route_for_methods TSRMLS_CC);

/*
* Listen for Artisan commands so we can name those appropriately.
*/
Expand Down
44 changes: 35 additions & 9 deletions agent/newrelic-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ error() {
ostype=
if [ -f /etc/redhat-release -o -f /etc/redhat_version ]; then
ostype=rhel
elif [ -d /etc/dpkg ]; then
elif [ -f /etc/os-release ] && grep -q -i 'Debian' /etc/os-release; then
ostype=debian
elif [ -f /etc/alpine-release ] || [ -d /etc/apk ]; then
ostype=alpine
Expand All @@ -135,10 +135,10 @@ fi
if [ -z "${ostype}" ]; then
tus=`uname -s 2> /dev/null`
case "${tus}" in
[Dd][Aa][Rr][Ww][Ii][Nn]) ostype=darwin ;;
[Dd][Aa][Rr][Ww][Ii][Nn]) ostype=unsupported_os ;;
[Ff][Rr][Ee][Ee][Bb][Ss][Dd]) ostype=freebsd ;;
[Ss][Uu][Nn][Oo][Ss]) ostype=solaris ;;
[Ss][Mm][Aa][Rr][Tt][Oo][Ss]) ostype=solaris ;;
[Ss][Uu][Nn][Oo][Ss]) ostype=unsupported_os ;;
[Ss][Mm][Aa][Rr][Tt][Oo][Ss]) ostype=unsupported_os ;;
esac
fi
: ${ostype:=generic}
Expand Down Expand Up @@ -221,6 +221,7 @@ arch=`(uname -m) 2> /dev/null` || arch="unknown"
os=`(uname -s) 2> /dev/null` || os="unknown"

case "${arch}" in
aarch64 | arm64) arch=aarch64 ;;
i[3456789]86) arch=x86 ;;
*64* | *amd*) arch=x64 ;;
i86pc)
Expand All @@ -237,13 +238,30 @@ case "${arch}" in
unknown) arch=x86 ;;
esac

case "${os}" in
[dD]arwin* ) os="darwin"; arch="x86_64" ;;
*) ;;
esac

# allow override of detected arch
[ "${NR_INSTALL_ARCH}" = "x86" -o "${NR_INSTALL_ARCH}" = "x64" -o "${NR_INSTALL_ARCH}" = "x86_64" ] && arch="${NR_INSTALL_ARCH}"

# exit if arch is unsupported
if [ "${arch}" != "x86" -a "${arch}" != "x64" ]; then
error "An unsupported architecture "${arch}" detected."

if [ "${arch}" = "aarch64" ]; then
cat << EOF
In order to use the New Relic PHP Agent on the "aarch64" (also known as "ARM64")
architecture it is necessary to build the agent extension from sources.
Instructions on how to build the agent are available here:
https://docs.newrelic.com/docs/apm/agents/php-agent/installation/php-agent-installation-arm64/
EOF
fi

echo "The install will now exit."
exit 1
fi

#
# Do some sanity checking. ilibdir should contain the daemon, the agents and
# the init scripts. Ensure that is the case.
Expand Down Expand Up @@ -1093,6 +1111,14 @@ Ignoring this particular instance of PHP.
pi_arch="${arch}"
fi

# Check if this is a supported arch
# Should be caught on startup but add check here to be sure
if [ "${pi_arch}" != "x86" -a "${pi_arch}" != "x64" ]; then
error "An unsupported architecture "${pi_arch}" detected."
echo "The install will now exit."
exit 1
fi

# This handles both 32-bit on 64-bit systems and 32-bit only systems
if [ "${pi_arch}" = "x86" -a "${pi_php8}" = "yes" ]; then
error "unsupported 32-bit version '${pi_ver}' of PHP found at:
Expand Down
8 changes: 5 additions & 3 deletions agent/php_execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,11 @@ static const nr_framework_table_t all_frameworks[] = {
NR_FW_LARAVEL}, /* 5.0.15-5.0.x */
{"Laravel", "laravel", "bootstrap/cache/compiled.php", 0, nr_laravel_enable,
NR_FW_LARAVEL}, /* 5.1.0-x */
{"Laravel", "laravel", "bootstrap/app.php", 0, nr_laravel_enable,
NR_FW_LARAVEL}, /* 8+ */

{"Lumen", "lumen", "lumen-framework/src/helpers.php", 0, nr_lumen_enable, NR_FW_LUMEN},
{"Lumen", "lumen", "lumen-framework/src/helpers.php", 0, nr_lumen_enable,
NR_FW_LUMEN},

{"Magento", "magento", "app/mage.php", 0, nr_magento1_enable,
NR_FW_MAGENTO1},
Expand Down Expand Up @@ -1072,8 +1075,7 @@ static inline void nr_php_execute_segment_end(
duration = nr_time_duration(stacked->start_time, stacked->stop_time);

if (create_metric || (duration >= NR_PHP_PROCESS_GLOBALS(expensive_min))
|| nr_vector_size(stacked->metrics) || stacked->id
|| stacked->attributes
|| nr_vector_size(stacked->metrics) || stacked->id || stacked->attributes
|| stacked->error) {
nr_segment_t* s = nr_php_stacked_segment_move_to_heap(stacked TSRMLS_CC);
nr_php_execute_segment_add_metric(s, metadata, create_metric);
Expand Down
9 changes: 8 additions & 1 deletion agent/php_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ typedef struct _nrphpglobals_t {
mode */
int daemon_special_integration; /* Cause daemon to dump special log entries to
help integration testing. */
int zend_offset; /* Zend extension offset */
#if ZEND_MODULE_API_NO >= ZEND_8_1_X_API_NO /* PHP 8.1+ */
zend_long zend_offset; /* Zend extension offset */
zend_long
zend_op_array_offset; /* Zend extension op_array to modify reserved */
#else
int zend_offset; /* Zend extension offset */
int zend_op_array_offset; /* Zend extension op_array to modify reserved */
#endif
int done_instrumentation; /* Set to true if we have installed instrumentation
handlers */
nrtime_t expensive_min; /* newrelic.special.expensive_node_min */
Expand Down
11 changes: 6 additions & 5 deletions agent/php_newrelic.h
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ nrinitime_t ep_threshold; /* newrelic.transaction_tracer.explain_threshold */
nrinitime_t
ss_threshold; /* newrelic.transaction_tracer.stack_trace_threshold */
nrinibool_t
cross_process_enabled; /* newrelic.cross_application_tracer.enabled */
cross_process_enabled; /* DEPRECATED
newrelic.cross_application_tracer.enabled */

nriniuint_t max_nesting_level; /* newrelic.special.max_nesting_level (named
after like-used variable in xdebug) */
Expand Down Expand Up @@ -444,17 +445,17 @@ nrinibool_t
nrinibool_t
distributed_tracing_exclude_newrelic_header; /* newrelic.distributed_tracing_exclude_newrelic_header
*/
nrinibool_t span_events_enabled; /* newrelic.span_events_enabled */
nriniuint_t max_span_events; /* newrelic.special.max_span_events */
nrinibool_t span_events_enabled; /* newrelic.span_events_enabled */
nriniuint_t span_events_max_samples_stored; /* newrelic.span_events.max_samples_stored
*/
nrinistr_t
trace_observer_host; /* newrelic.infinite_tracing.trace_observer.host */
nriniuint_t
trace_observer_port; /* newrelic.infinite_tracing.trace_observer.port */
nriniuint_t
span_queue_size; /* newrelic.infinite_tracing.span_events.queue_size */
nriniuint_t
agent_span_queue_size; /* newrelic.infinite_tracing.span_events.agent_queue.size
*/
agent_span_queue_size; /* newrelic.infinite_tracing.span_events.agent_queue.size*/
nrinitime_t
agent_span_queue_timeout; /* newrelic.infinite_tracing.span_events.agent_queue.timeout
*/
Expand Down
Loading

0 comments on commit 96828fa

Please sign in to comment.