From 2351338ac59b980fd031efb95f0eff7db5b1ea89 Mon Sep 17 00:00:00 2001 From: Roman Fursov Date: Mon, 27 Nov 2023 18:52:58 +0100 Subject: [PATCH] Improve DEBUG level logs; unify BUILD dependencies format (#64) --- .../google/cloud/bigquery/dwhassessment/hooks/BUILD | 2 +- .../cloud/bigquery/dwhassessment/hooks/logger/BUILD | 2 +- .../dwhassessment/hooks/logger/EventLogger.java | 11 +++++++---- .../cloud/bigquery/dwhassessment/hooks/testing/BUILD | 8 ++++---- .../cloud/bigquery/dwhassessment/hooks/logger/BUILD | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/BUILD b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/BUILD index 2a8560c..b0cf3ef 100644 --- a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/BUILD +++ b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/BUILD @@ -23,7 +23,7 @@ java_library( "//src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger", "//src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/exception", "//src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/utils", - "@maven//:org_apache_hadoop_hadoop_mapred_0_22_0", + "@maven//:org_apache_hadoop_hadoop_mapred", "@maven//:org_apache_hive_hive_exec", "@maven//:org_slf4j_slf4j_api", ], diff --git a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD index 809b3c0..a4c6168 100644 --- a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD +++ b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD @@ -31,7 +31,7 @@ java_library( "@maven//:org_apache_hadoop_hadoop_yarn_api", "@maven//:org_apache_hadoop_hadoop_yarn_client", "@maven//:org_apache_hive_hive_exec", - "@maven//:org_apache_tez_tez_api_0_8_5", + "@maven//:org_apache_tez_tez_api", "@maven//:org_slf4j_slf4j_api", ], ) diff --git a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/EventLogger.java b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/EventLogger.java index 8552ae7..4c7f0ec 100644 --- a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/EventLogger.java +++ b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger/EventLogger.java @@ -137,7 +137,7 @@ public void handle(HookContext hookContext) { // before we start the pre hook processing and causes inconsistent events publishing. QueryPlan plan = hookContext.getQueryPlan(); if (plan == null) { - LOG.debug("Received null query plan."); + LOG.debug("Received null query plan, skipping query event."); return; } @@ -147,7 +147,7 @@ public void handle(HookContext hookContext) { } private void tryWriteEvent(GenericRecord event, HookType hookType) { - LOG.debug("Trying to handle an event '{}' for query '{}'", hookType, event.get("QueryId")); + LOG.debug("Trying to handle an event '{}' for record '{}'", hookType, event); try { // ScheduledThreadPoolExecutor uses an unbounded queue which cannot be replaced with a // bounded queue. @@ -156,10 +156,13 @@ private void tryWriteEvent(GenericRecord event, HookType hookType) { logWriter.execute(() -> writeEventWithRetries(event)); } else { LOG.warn( - "Writer queue full. Ignoring event '{}' for query '{}'", hookType, event.get("QueryId")); + "Writer queue full. Ignoring event '{}' for query '{}'", + hookType, + event.get("QueryId")); } } catch (RejectedExecutionException e) { - LOG.warn("Writer queue full. Ignoring event '{}' for query '{}'", hookType, event.get("QueryId")); + LOG.warn( + "Writer queue full. Ignoring event '{}' for query '{}'", hookType, event.get("QueryId")); } } diff --git a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/testing/BUILD b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/testing/BUILD index 5fb39c4..fadba5e 100644 --- a/src/java/com/google/cloud/bigquery/dwhassessment/hooks/testing/BUILD +++ b/src/java/com/google/cloud/bigquery/dwhassessment/hooks/testing/BUILD @@ -17,14 +17,14 @@ package(default_visibility = ["//src:internal"]) java_library( name = "testing", - srcs = glob(["*.java"]), testonly = 1, + srcs = glob(["*.java"]), deps = [ "//src/java/com/google/cloud/bigquery/dwhassessment/hooks/logger", - "@maven_tests//:org_apache_avro_avro", - "@maven_tests//:org_apache_hadoop_hadoop_common", - "@maven_tests//:org_apache_hive_hive_exec_2_2_0", "@maven_tests//:com_google_guava_guava", "@maven_tests//:com_google_truth_truth", + "@maven_tests//:org_apache_avro_avro", + "@maven_tests//:org_apache_hadoop_hadoop_common", + "@maven_tests//:org_apache_hive_hive_exec", ], ) diff --git a/src/javatests/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD b/src/javatests/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD index 0533fca..86da1c0 100644 --- a/src/javatests/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD +++ b/src/javatests/com/google/cloud/bigquery/dwhassessment/hooks/logger/BUILD @@ -55,8 +55,8 @@ java_library( "@maven_tests//:org_apache_hadoop_hadoop_yarn_common", "@maven_tests//:org_apache_hive_hive_common", "@maven_tests//:org_apache_hive_hive_exec", - "@maven_tests//:org_apache_tez_tez_api_0_8_5", - "@maven_tests//:org_apache_tez_tez_dag_0_8_5", + "@maven_tests//:org_apache_tez_tez_api", + "@maven_tests//:org_apache_tez_tez_dag", "@maven_tests//:org_mockito_mockito_core", "@maven_tests//:org_slf4j_slf4j_api", ],