Skip to content

Commit

Permalink
Merge pull request #49 from humanmade/correct-errors
Browse files Browse the repository at this point in the history
Fix up errors
  • Loading branch information
rmccue authored Jan 27, 2020
2 parents eca315f + 9f09e17 commit dab5459
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace HM\Platform\XRay;

use Exception;
use function HM\Platform\get_aws_sdk;
use GuzzleHttp\TransferStats;

/*
Expand Down Expand Up @@ -32,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() );
}
});

Expand Down Expand Up @@ -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.
*
Expand Down Expand Up @@ -443,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,
],
];

Expand Down

0 comments on commit dab5459

Please sign in to comment.