From ba59c9ee7a4cfb37ba325d2e3661ea3d7115e050 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Mon, 27 Jan 2020 17:25:33 +0000 Subject: [PATCH 1/3] Remove unused code --- inc/namespace.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/inc/namespace.php b/inc/namespace.php index 56d6ef5..83c33ae 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -2,8 +2,6 @@ namespace HM\Platform\XRay; -use Exception; -use function HM\Platform\get_aws_sdk; use GuzzleHttp\TransferStats; /* @@ -170,25 +168,6 @@ function trace_wpdb_query( string $query, float $start_time, float $end_time, $e send_trace_to_daemon( $trace ); } -/** - * Send a XRay trace document to AWS using the HTTP API. - * - * This is slower than using the XRay Daemon, but more convenient. - * - * @param array $trace - */ -function send_trace_to_aws( array $trace ) { - try { - $response = get_aws_sdk()->createXRay( [ 'version' => '2016-04-12' ] )->putTraceSegments( - [ - 'TraceSegmentDocuments' => [ json_encode( $trace ) ], // @codingStandardsIgnoreLine wp_json_encode not available. - ] - ); - } catch ( Exception $e ) { - trigger_error( $e->getMessage(), E_USER_WARNING ); // @codingStandardsIgnoreLine trigger_error ok - } -} - /** * Send a XRay trace document to AWS using the local daemon running on port 2000. * From 0789ff2434d8f01da5898f1fa08dc71c635b6606 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Mon, 27 Jan 2020 17:25:40 +0000 Subject: [PATCH 2/3] Pass correct value for end time --- inc/namespace.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/namespace.php b/inc/namespace.php index 83c33ae..7cd6b81 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -422,7 +422,7 @@ function get_xhprof_trace() : array { 'value' => 1, 'children' => [], 'start_time' => $hm_platform_xray_start_time, - 'end_time' => $hm_platform_xray_start_time, + 'end_time' => $end_time, ], ]; From 9f09e172f2da215d75420f397371ab707a08f930 Mon Sep 17 00:00:00 2001 From: Ryan McCue Date: Mon, 27 Jan 2020 17:27:16 +0000 Subject: [PATCH 3/3] Correct spelling mistake --- inc/namespace.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inc/namespace.php b/inc/namespace.php index 7cd6b81..c3cebe0 100644 --- a/inc/namespace.php +++ b/inc/namespace.php @@ -30,10 +30,10 @@ function bootstrap() { register_shutdown_function( __NAMESPACE__ . '\\on_shutdown' ); } - $current_errror_handler = set_error_handler( function () use ( &$current_errror_handler ) { // @codingStandardsIgnoreLine + $current_error_handler = set_error_handler( function () use ( &$current_error_handler ) { // @codingStandardsIgnoreLine call_user_func_array( __NAMESPACE__ . '\\error_handler', func_get_args() ); - if ( $current_errror_handler ) { - call_user_func_array( $current_errror_handler, func_get_args() ); + if ( $current_error_handler ) { + call_user_func_array( $current_error_handler, func_get_args() ); } });