@@ -1970,6 +1970,55 @@ static PHP_INI_MH(nr_wordpress_hooks_options_mh) {
19701970 return SUCCESS ;
19711971}
19721972
1973+ static PHP_INI_MH (nr_dt_sampler_remote_parent_mh ) {
1974+ nrinistr_t * p ;
1975+
1976+ char * base = (char * )mh_arg2 ;
1977+ p = (nrinistr_t * )(base + (size_t )mh_arg1 );
1978+ bool parent_sampled = false;
1979+
1980+ (void )mh_arg3 ;
1981+ NR_UNUSED_TSRMLS ;
1982+
1983+ p -> where = 0 ;
1984+
1985+ if (0 == nr_strcmp (ZEND_STRING_VALUE (entry -> name ),
1986+ "newrelic.distributed_tracing.sampler.remote_parent_sampled" )) {
1987+ parent_sampled = true;
1988+ }
1989+
1990+ if (0 == nr_strcmp (NEW_VALUE , "default" )) {
1991+ if (parent_sampled ) {
1992+ NRPRG (dt_sampler_parent_sampled ) = DEFAULT ;
1993+ } else {
1994+ NRPRG (dt_sampler_parent_not_sampled ) = DEFAULT ;
1995+ }
1996+ } else if (0 == nr_strcmp (NEW_VALUE , "always_on" )) {
1997+ if (parent_sampled ) {
1998+ NRPRG (dt_sampler_parent_sampled ) = ALWAYS_KEEP ;
1999+ } else {
2000+ NRPRG (dt_sampler_parent_not_sampled ) = ALWAYS_KEEP ;
2001+ }
2002+ } else if (0 == nr_strcmp (NEW_VALUE , "always_off" )) {
2003+ if (parent_sampled ) {
2004+ NRPRG (dt_sampler_parent_sampled ) = ALWAYS_DROP ;
2005+ } else {
2006+ NRPRG (dt_sampler_parent_not_sampled ) = ALWAYS_DROP ;
2007+ }
2008+ } else {
2009+ nrl_warning (NRL_INIT , "Invalid %s value \"%s\"; using \"%s\" instead." ,
2010+ ZEND_STRING_VALUE (entry -> name ), NEW_VALUE ,
2011+ DEFAULT_WORDPRESS_HOOKS_OPTIONS );
2012+ /* This will cause PHP to call the handler again with default value */
2013+ return FAILURE ;
2014+ }
2015+
2016+ p -> where = stage ;
2017+ p -> value = NEW_VALUE ;
2018+
2019+ return SUCCESS ;
2020+ }
2021+
19732022/*
19742023 * Now for the actual INI entry table. Please note there are two types of INI
19752024 * entry specification used.
@@ -2938,6 +2987,24 @@ STD_PHP_INI_ENTRY_EX("newrelic.distributed_tracing_exclude_newrelic_header",
29382987 newrelic_globals ,
29392988 0 )
29402989
2990+
2991+ STD_PHP_INI_ENTRY_EX ("newrelic.distributed_tracing.sampler.remote_parent_sampled" ,
2992+ "default" ,
2993+ NR_PHP_REQUEST ,
2994+ nr_dt_sampler_remote_parent_mh ,
2995+ dt_remote_parent_sampled ,
2996+ zend_newrelic_globals ,
2997+ newrelic_globals ,
2998+ 0 )
2999+ STD_PHP_INI_ENTRY_EX ("newrelic.distributed_tracing.sampler.remote_parent_not_sampled" ,
3000+ "default" ,
3001+ NR_PHP_REQUEST ,
3002+ nr_dt_sampler_remote_parent_mh ,
3003+ dt_remote_parent_not_sampled ,
3004+ zend_newrelic_globals ,
3005+ newrelic_globals ,
3006+ 0 )
3007+
29413008/*
29423009 * This setting is not documented and affects the length of the interally used
29433010 * trace id. This INI setting should not be modified unless requested by
0 commit comments