diff --git a/prometheus-collectors/class-potential-multi-dataset-queries-collector.php b/prometheus-collectors/class-potential-multi-dataset-queries-collector.php index b58566d9da..dee8e78bac 100644 --- a/prometheus-collectors/class-potential-multi-dataset-queries-collector.php +++ b/prometheus-collectors/class-potential-multi-dataset-queries-collector.php @@ -51,17 +51,23 @@ public function sql_query_log( $query ): void { ] ); + if ( ! function_exists( '\Automattic\VIP\Logstash\log2logstash' ) ) { + return; + } + $backtrace = function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 4, false ) : []; // phpcs:ignore \Automattic\VIP\Logstash\log2logstash( [ 'severity' => 'debug', 'feature' => 'potential_multi_dataset_queries', 'message' => 'Potential multi dataset query detected', - 'blog_id' => get_current_blog_id(), 'extra' => [ - 'uri' => isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( $_SERVER['REQUEST_URI'] ) : '', - 'http_method' => isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( $_SERVER['REQUEST_METHOD'] ) : '', - 'backtrace' => $backtrace, + 'uri' => isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( $_SERVER['REQUEST_URI'] ) : '', + 'http_method' => isset( $_SERVER['REQUEST_METHOD'] ) ? sanitize_text_field( $_SERVER['REQUEST_METHOD'] ) : '', + 'backtrace' => $backtrace, + 'last_global_table' => $last_global_table, + 'last_blog_table' => $last_blog_table, + 'blog_ids_count' => $blog_ids_count, ], ] );