Skip to content

Commit

Permalink
fix: add logging for reporting errors. useful for debugging config-ma… (
Browse files Browse the repository at this point in the history
#1707)

Summary: Adds logging for reporting errors, which is useful for
debugging config-map based queries which do not appear to report errors
elsewhere

Type of change: /kind fix

Test Plan: Existing test cases should suffice as no new functionality is
really added here. just additional logging.

Signed-off-by: Tim Rupp <[email protected]>
  • Loading branch information
caphrim007 authored Sep 18, 2023
1 parent e78916b commit 1e0654e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/carnot/planner/objects/otel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ StatusOr<std::vector<OTelAttribute>> ParseAttributes(DictObject* attributes) {
return keyobj->CreateError("Attribute key must be a non-empty string");
}
if (!ExprObject::IsExprObject(values[idx])) {
return values[idx]->CreateError("Expected column or string for attribute value, got '$0'",
QLObjectTypeString(values[idx]->type()));
return values[idx]->CreateError(
"Expr is not an Object. Expected column or string for attribute value, got '$0'",
QLObjectTypeString(values[idx]->type()));
}
auto expr = static_cast<ExprObject*>(values[idx].get())->expr();
if (Match(expr, ColumnNode())) {
Expand Down
17 changes: 17 additions & 0 deletions src/vizier/services/query_broker/controllers/query_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,25 +207,42 @@ func (q *QueryExecutorImpl) Wait() error {
// There are a few common failure cases that may occur naturally during query execution. For example, ctxDeadlineExceeded,
// and invalid arguments. In this case, we do not want to unnecessarily log our error state.
if strings.Contains(err.Error(), "Distributed state does not have a Carnot instance") {
log.WithField("query_id", q.queryID).
WithError(err).
Error("Distributed state does not have a Carnot instance")
return err
}
if strings.Contains(err.Error(), "InvalidArgument") {
log.WithField("query_id", q.queryID).
WithError(err).
Error("InvalidArgument")
return err
}
if strings.Contains(err.Error(), "failed to initialize all result tables") {
log.WithField("query_id", q.queryID).
WithError(err).
Error("failed to initialize all result tables")
return err
}
if errors.Is(err, nats.ErrConnectionClosed) {
log.WithField("query_id", q.queryID).
WithError(err).
Error("NATS connection closed")
return err
}
if errors.Is(err, context.DeadlineExceeded) {
log.WithField("query_id", q.queryID).
WithError(err).
Error("Context deadline exceeded")
return err
}

if errors.Is(err, context.Canceled) {
log.WithField("query_id", q.queryID).
Info("Query cancelled")
return err
}

log.WithField("query_id", q.queryID).
WithField("duration", time.Since(q.startTime)).
WithError(err).
Expand Down

0 comments on commit 1e0654e

Please sign in to comment.