@@ -800,35 +800,6 @@ static void nr_php_instrument_datastore_operation_call(
800
800
}
801
801
}
802
802
803
- /*
804
- * Like nr_php_instrument_datastore_operation_call() but does not
805
- * call the underlying internal function. This allows multiple
806
- * datastore metrics to be creating during a single underlying
807
- * PHP call.
808
- */
809
- static void nr_php_instrument_datastore_operation (
810
- nr_datastore_t datastore ,
811
- const char * operation ,
812
- nr_datastore_instance_t * instance ,
813
- bool instance_only ) {
814
- nr_segment_t * segment = NULL ;
815
- nr_segment_datastore_params_t params = {
816
- .datastore = {
817
- .type = datastore ,
818
- },
819
- .operation = nr_strdup (operation ),
820
- .instance = instance ,
821
- .instance_only = instance_only ,
822
- .callbacks = {
823
- .backtrace = nr_php_backtrace_callback ,
824
- },
825
- };
826
-
827
- segment = nr_segment_start (NRPRG (txn ), NULL , NULL );
828
- nr_segment_datastore_end (& segment , & params );
829
- nr_free (params .operation );
830
- }
831
-
832
803
/*
833
804
* Handle
834
805
* bool mysqli_commit ( object $link [, int $flags=0, string $name] )
@@ -1570,32 +1541,37 @@ NR_INNER_WRAPPER(memcached_add_server) {
1570
1541
zend_long port = 0 ;
1571
1542
zend_long weight = 0 ;
1572
1543
nr_datastore_instance_t * instance = NULL ;
1544
+ char * instance_metric = NULL ;
1573
1545
int zcaught = 0 ;
1546
+ nr_segment_t * segment = nr_segment_start (NRPRG (txn ), NULL , NULL );
1574
1547
1575
1548
if (SUCCESS
1576
1549
== zend_parse_parameters_ex (
1577
1550
ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "s|ll" , & host ,
1578
1551
& host_len , & port , & weight ) &&
1579
1552
NULL != host ) {
1580
1553
instance = nr_php_memcached_create_datastore_instance (host , port );
1581
- nr_php_instrument_datastore_operation_call (nr_wrapper , NR_DATASTORE_MEMCACHE ,
1582
- NULL , instance , true,
1583
- INTERNAL_FUNCTION_PARAM_PASSTHRU );
1584
- } else {
1585
- zcaught = nr_zend_call_old_handler (nr_wrapper -> oldhandler ,
1586
- INTERNAL_FUNCTION_PARAM_PASSTHRU );
1587
- if (zcaught ) {
1588
- zend_bailout ();
1589
- /* NOTREACHED */
1590
- }
1554
+ instance_metric = nr_formatf ("Datastore/instance/Memcached/%s/%s" ,
1555
+ instance -> host , instance -> port_path_or_id );
1556
+ nr_free (instance );
1557
+ nr_segment_add_metric (segment , instance_metric , false);
1558
+ }
1559
+ zcaught = nr_zend_call_old_handler (nr_wrapper -> oldhandler ,
1560
+ INTERNAL_FUNCTION_PARAM_PASSTHRU );
1561
+ nr_segment_end (& segment );
1562
+ if (zcaught ) {
1563
+ zend_bailout ();
1564
+ /* NOTREACHED */
1591
1565
}
1592
1566
}
1593
1567
1594
1568
NR_INNER_WRAPPER (memcached_add_servers ) {
1595
1569
zval * servers = NULL ;
1596
1570
zval * server = NULL ;
1597
1571
nr_datastore_instance_t * instance = NULL ;
1572
+ char * instance_metric = NULL ;
1598
1573
int zcaught = 0 ;
1574
+ nr_segment_t * segment = nr_segment_start (NRPRG (txn ), NULL , NULL );
1599
1575
1600
1576
if (SUCCESS
1601
1577
== zend_parse_parameters_ex (
@@ -1607,8 +1583,10 @@ NR_INNER_WRAPPER(memcached_add_servers) {
1607
1583
if (NULL != host && NULL != port &&
1608
1584
Z_TYPE_P (host ) == IS_STRING && Z_TYPE_P (port ) == IS_LONG ) {
1609
1585
instance = nr_php_memcached_create_datastore_instance (Z_STRVAL_P (host ), Z_LVAL_P (port ));
1610
- nr_php_instrument_datastore_operation (NR_DATASTORE_MEMCACHE ,
1611
- NULL , instance , true);
1586
+ instance_metric = nr_formatf ("Datastore/instance/Memcached/%s/%s" ,
1587
+ instance -> host , instance -> port_path_or_id );
1588
+ nr_segment_add_metric (segment , instance_metric , false);
1589
+ nr_free (instance );
1612
1590
}
1613
1591
}
1614
1592
ZEND_HASH_FOREACH_END ();
@@ -1617,6 +1595,7 @@ NR_INNER_WRAPPER(memcached_add_servers) {
1617
1595
zcaught = nr_zend_call_old_handler (nr_wrapper -> oldhandler ,
1618
1596
INTERNAL_FUNCTION_PARAM_PASSTHRU );
1619
1597
1598
+ nr_segment_end (& segment );
1620
1599
if (zcaught ) {
1621
1600
zend_bailout ();
1622
1601
/* NOTREACHED */
0 commit comments