Skip to content

Commit 9409457

Browse files
authored
Merge pull request #1022 from newrelic/dev
Release 11.6
2 parents 5b320e8 + 0bd1728 commit 9409457

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4476
-62
lines changed

.github/workflows/test-agent.yml

+33
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,39 @@ jobs:
4444
echo "$GOFMT_REPORTED_FILES" >> $GITHUB_STEP_SUMMARY
4545
exit 1
4646
fi
47+
govet:
48+
runs-on: ubuntu-latest
49+
continue-on-error: true
50+
steps:
51+
- name: Checkout newrelic-php-agent code
52+
uses: actions/checkout@v4
53+
with:
54+
path: php-agent
55+
- name: Get go version
56+
id: get-go-version
57+
run: |
58+
echo "go toolchain version required to build the daemon:"
59+
toolchain="$(awk '/^toolchain */ {gsub(/^go/, "", $2); print $2}' ./php-agent/daemon/go.mod)"
60+
echo "[${toolchain}]"
61+
echo "go-toolchain-version=${toolchain}" >> $GITHUB_OUTPUT
62+
- name: Setup go
63+
uses: actions/setup-go@v5
64+
with:
65+
go-version: ${{ steps.get-go-version.outputs.go-toolchain-version }}
66+
cache-dependency-path: "**/*.sum"
67+
- name: Verify go version
68+
run: |
69+
echo "Verify correct go toolchain version is used"
70+
actual="$(go version)"
71+
echo "Actual: [$actual]"
72+
expected="go version go${{ steps.get-go-version.outputs.go-toolchain-version }} linux/amd64"
73+
echo "Expected: [$expected]"
74+
if [ "$actual" != "$expected" ]; then
75+
exit 1
76+
fi
77+
- name: Run go vet
78+
run: go vet -C ./php-agent/daemon ./...
79+
shell: bash
4780
daemon-unit-tests:
4881
runs-on: ubuntu-latest
4982
env:

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11.5.0
1+
11.6.0

agent/Makefile.frag

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ TEST_BINARIES = \
9393
tests/test_internal_instrument \
9494
tests/test_hash \
9595
tests/test_lib_aws_sdk_php \
96+
tests/test_lib_php_amqplib \
9697
tests/test_memcached \
9798
tests/test_mongodb \
9899
tests/test_monolog \

agent/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ if test "$PHP_NEWRELIC" = "yes"; then
231231
LIBRARIES="lib_aws_sdk_php.c lib_monolog.c lib_doctrine2.c lib_guzzle3.c \
232232
lib_guzzle4.c lib_guzzle6.c lib_guzzle_common.c \
233233
lib_mongodb.c lib_phpunit.c lib_predis.c lib_zend_http.c \
234-
lib_composer.c"
234+
lib_composer.c lib_php_amqplib.c"
235235
PHP_NEW_EXTENSION(newrelic, $FRAMEWORKS $LIBRARIES $NEWRELIC_AGENT, $ext_shared,, $(NEWRELIC_CFLAGS))
236236

237237
PHP_SUBST(NEWRELIC_CFLAGS)

agent/fw_hooks.h

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ extern void nr_guzzle4_enable(TSRMLS_D);
4646
extern void nr_guzzle6_enable(TSRMLS_D);
4747
extern void nr_laminas_http_enable(TSRMLS_D);
4848
extern void nr_mongodb_enable(TSRMLS_D);
49+
extern void nr_php_amqplib_enable();
4950
extern void nr_phpunit_enable(TSRMLS_D);
5051
extern void nr_predis_enable(TSRMLS_D);
5152
extern void nr_zend_http_enable(TSRMLS_D);

agent/fw_laravel_queue.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ static void nr_laravel_queue_set_cat_txn(zval* job TSRMLS_DC) {
136136
}
137137

138138
if (headers.dt_payload || headers.traceparent) {
139-
140139
nr_hashmap_t* header_map = nr_header_create_distributed_trace_map(
141140
headers.dt_payload, headers.traceparent, headers.tracestate);
142141

@@ -225,6 +224,11 @@ static char* nr_laravel_queue_job_txn_name(zval* job TSRMLS_DC) {
225224

226225
name = nr_formatf("%s (%s:%s)", resolve_name, connection_name, queue_name);
227226

227+
nr_free(connection_name);
228+
nr_free(resolve_name);
229+
nr_free(queue_name);
230+
231+
/* Caller is responsible for freeing name. */
228232
return name;
229233
}
230234

@@ -252,6 +256,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_syncqueue_raiseBeforeJobEvent_before) {
252256

253257
job = nr_php_arg_get(1, NR_EXECUTE_ORIG_ARGS);
254258

259+
/* txn_name needs to be freed by the caller. */
255260
txn_name = nr_laravel_queue_job_txn_name(job);
256261

257262
/*
@@ -271,6 +276,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_syncqueue_raiseBeforeJobEvent_before) {
271276
NR_OK_TO_OVERWRITE);
272277
}
273278
nr_php_arg_release(&job);
279+
nr_free(txn_name);
274280
NR_PHP_WRAPPER_CALL;
275281
}
276282
NR_PHP_WRAPPER_END
@@ -317,6 +323,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_raiseBeforeJobEvent_after) {
317323
nr_txn_set_path("Laravel", NRPRG(txn), txn_name, NR_PATH_TYPE_CUSTOM,
318324
NR_OK_TO_OVERWRITE);
319325
}
326+
nr_free(txn_name);
320327
nr_php_arg_release(&job);
321328
NR_PHP_WRAPPER_CALL;
322329
}
@@ -574,7 +581,7 @@ NR_PHP_WRAPPER(nr_laravel_queue_worker_process) {
574581
* as the first parameter.
575582
*/
576583
char* connection_name = NULL;
577-
char* job_name;
584+
char* job_name = NULL;
578585
char* txn_name = NULL;
579586

580587
connection = nr_php_arg_get(1, NR_EXECUTE_ORIG_ARGS TSRMLS_CC);

0 commit comments

Comments
 (0)