Skip to content

Commit 30f9fca

Browse files
authored
Merge pull request #591 from newrelic/dev
Release 10.4
2 parents 4571e4f + ea45cc9 commit 30f9fca

Some content is hidden

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

48 files changed

+2153
-89
lines changed

Makefile

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,74 @@ src/newrelic/infinite_tracing/com_newrelic_trace_v1/v1.pb.go: protocol/infinite_
315315
#
316316

317317
.PHONY: integration
318-
integration: Makefile daemon lasp-test-all
318+
integration: Makefile daemon lasp-test-all integration-events-limits
319319
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
320320
echo; echo "# PHP=$${PHP}"; \
321321
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) || exit 1; \
322322
echo "# PHP=$${PHP}"; \
323323
done
324324

325+
#
326+
# Agent event limits integration testing
327+
#
328+
# Because of how the integration_runner connects to the collector (once before
329+
# running any tests) we have to tell the runner the value the agent would
330+
# have passed to it for each test. This means these tests are not testing
331+
# the agent <-> daemon communcations of the agent's requested custom event limit
332+
# via the daemon to the collector and daemon sending back the collectors harvest
333+
# limit value.
334+
#
335+
336+
.PHONY: integration-events-limits
337+
integration-events-limits: daemon
338+
# create array with the collector response for each agent requested custom events max samples
339+
# currently based on fast harvest cycle being 5 seconds so ratio is 12:1
340+
declare -A custom_limits_tests; \
341+
custom_limits_tests[240]=20; \
342+
custom_limits_tests[7000]=583; \
343+
custom_limits_tests[30000]=2500; \
344+
custom_limits_tests[100000]=8333; \
345+
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
346+
echo; echo "# PHP=$${PHP}"; \
347+
for custom_max in "$${!custom_limits_tests[@]}"; do \
348+
collector_limit=$${custom_limits_tests[$$custom_max]}; \
349+
php_test_file="tests/event_limits/custom/test_custom_events_max_samples_stored_$${custom_max}_limit.php"; \
350+
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
351+
-max_custom_events $${custom_max} $${php_test_file} || exit 1; \
352+
done; \
353+
echo "# PHP=$${PHP}"; \
354+
done;
355+
356+
# test for invalid value (-1) and (1000000)
357+
# Should use default (30000) for -1 and max (100000) for 1000000
358+
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
359+
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
360+
-max_custom_events 100000 \
361+
tests/event_limits/custom/test_custom_events_max_samples_stored_invalid_toolarge_limit.php || exit 1; \
362+
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
363+
-max_custom_events 30000 \
364+
tests/event_limits/custom/test_custom_events_max_samples_stored_invalid_toosmall_limit.php || exit 1; \
365+
echo "# PHP=$${PHP}"; \
366+
done;
367+
368+
# also run a test where limit is set to 0
369+
# default value is used
370+
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
371+
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
372+
-max_custom_events 0 \
373+
tests/event_limits/custom/test_custom_events_max_samples_stored_0_limit.php || exit 1; \
374+
echo "# PHP=$${PHP}"; \
375+
done;
376+
377+
# also run a test where no agent custom event limit is specified and verify
378+
# default value is used
379+
for PHP in $${PHPS:-8.1 8.0 7.4 7.3 7.2 7.1 7.0 5.6 5.5}; do \
380+
env NRLAMP_PHP=$${PHP} bin/integration_runner $(INTEGRATION_ARGS) \
381+
-max_custom_events 30000 \
382+
tests/event_limits/custom/test_custom_events_max_samples_stored_not_specified.php || exit 1; \
383+
echo "# PHP=$${PHP}"; \
384+
done;
385+
325386
#
326387
# Code profiling
327388
#

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10.3.0
1+
10.4.0

agent/php_agent.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
* Returns : A newly allocated JSON stack trace string or NULL on error.
8080
*/
8181
#define NR_PHP_STACKTRACE_LIMIT 300
82+
8283
extern char* nr_php_backtrace_to_json(zval* itrace TSRMLS_DC);
8384

8485
/*
@@ -802,7 +803,7 @@ extern zend_execute_data* nr_get_zend_execute_data(NR_EXECUTE_PROTO TSRMLS_DC);
802803
*
803804
*/
804805
static inline uint32_t nr_php_zend_function_lineno(const zend_function* func) {
805-
if (NULL != func) {
806+
if (NULL != func && ZEND_USER_FUNCTION == func->op_array.type) {
806807
return func->op_array.line_start;
807808
}
808809
return 0;

0 commit comments

Comments
 (0)