Skip to content

Commit

Permalink
refactor: supress log "failed to evaluate expression" (#14100)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuyufjh authored Dec 20, 2023
1 parent e0a9b80 commit 640befd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/expr/core/src/expr/wrapper/non_strict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::sync::LazyLock;

use async_trait::async_trait;
use auto_impl::auto_impl;
use risingwave_common::array::{ArrayRef, DataChunk};
use risingwave_common::log::LogSuppresser;
use risingwave_common::row::{OwnedRow, Row};
use risingwave_common::types::{DataType, Datum};
use thiserror_ext::AsReport;
Expand Down Expand Up @@ -49,7 +52,10 @@ pub struct LogReport;

impl EvalErrorReport for LogReport {
fn report(&self, error: ExprError) {
tracing::error!(error=%error.as_report(), "failed to evaluate expression");
static LOG_SUPPERSSER: LazyLock<LogSuppresser> = LazyLock::new(LogSuppresser::default);
if let Ok(suppressed_count) = LOG_SUPPERSSER.check() {
tracing::error!(error=%error.as_report(), suppressed_count, "failed to evaluate expression");
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions src/stream/src/executor/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
// limitations under the License.

use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::sync::{Arc, LazyLock};

use anyhow::anyhow;
use await_tree::InstrumentAwait;
use futures::future::join_all;
use hytra::TrAdder;
use parking_lot::Mutex;
use risingwave_common::error::ErrorSuppressor;
use risingwave_common::log::LogSuppresser;
use risingwave_common::metrics::GLOBAL_ERROR_METRICS;
use risingwave_common::util::epoch::EpochPair;
use risingwave_expr::expr_context::expr_context_scope;
Expand Down Expand Up @@ -84,7 +85,10 @@ impl ActorContext {
}

pub fn on_compute_error(&self, err: ExprError, identity: &str) {
tracing::error!(identity, error = %err.as_report(), "failed to evaluate expression");
static LOG_SUPPERSSER: LazyLock<LogSuppresser> = LazyLock::new(LogSuppresser::default);
if let Ok(suppressed_count) = LOG_SUPPERSSER.check() {
tracing::error!(identity, error = %err.as_report(), suppressed_count, "failed to evaluate expression");
}

let executor_name = identity.split(' ').next().unwrap_or("name_not_found");
let mut err_str = err.to_report_string();
Expand Down

0 comments on commit 640befd

Please sign in to comment.