Skip to content

Commit 2411f93

Browse files
authored
Store node_info in GenericExceptionOnRun logging event (#9559)
1 parent 5841d52 commit 2411f93

File tree

6 files changed

+293
-275
lines changed

6 files changed

+293
-275
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Fixes
2+
body: Store node_info in node associated logging events
3+
time: 2024-02-12T16:56:19.954358-05:00
4+
custom:
5+
Author: gshank
6+
Issue: "9557"

core/dbt/events/core_types.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ message SeedHeaderMsg {
12211221
message SQLRunnerException {
12221222
string exc = 1;
12231223
string exc_info = 2;
1224+
NodeInfo node_info = 3;
12241225
}
12251226

12261227
message SQLRunnerExceptionMsg {
@@ -1572,6 +1573,7 @@ message CatchableExceptionOnRunMsg {
15721573
message InternalErrorOnRun {
15731574
string build_path = 1;
15741575
string exc = 2;
1576+
NodeInfo node_info = 3;
15751577
}
15761578

15771579
message InternalErrorOnRunMsg {
@@ -1584,6 +1586,7 @@ message GenericExceptionOnRun {
15841586
string build_path = 1;
15851587
string unique_id = 2;
15861588
string exc = 3;
1589+
NodeInfo node_info = 4;
15871590
}
15881591

15891592
message GenericExceptionOnRunMsg {

core/dbt/events/core_types_pb2.py

Lines changed: 272 additions & 272 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/dbt/task/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,11 @@ def _handle_catchable_exception(self, e, ctx):
336336
return str(e)
337337

338338
def _handle_internal_exception(self, e, ctx):
339-
fire_event(InternalErrorOnRun(build_path=self.node.build_path, exc=str(e)))
339+
fire_event(
340+
InternalErrorOnRun(
341+
build_path=self.node.build_path, exc=str(e), node_info=get_node_info()
342+
)
343+
)
340344
return str(e)
341345

342346
def _handle_generic_exception(self, e, ctx):
@@ -345,6 +349,7 @@ def _handle_generic_exception(self, e, ctx):
345349
build_path=self.node.build_path,
346350
unique_id=self.node.unique_id,
347351
exc=str(e),
352+
node_info=get_node_info(),
348353
)
349354
)
350355
fire_event(LogDebugStackTrace(exc_info=traceback.format_exc()))

core/dbt/task/freshness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def execute(self, compiled_node, manifest):
157157
def compile(self, manifest):
158158
if self.node.resource_type != NodeType.Source:
159159
# should be unreachable...
160-
raise DbtRuntimeError("fresnhess runner: got a non-Source")
160+
raise DbtRuntimeError("freshness runner: got a non-Source")
161161
# we don't do anything interesting when we compile a source node
162162
return self.node
163163

core/dbt/task/sql.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ def __init__(self, config, adapter, node, node_index, num_nodes) -> None:
2424
CompileRunner.__init__(self, config, adapter, node, node_index, num_nodes)
2525

2626
def handle_exception(self, e, ctx):
27-
fire_event(SQLRunnerException(exc=str(e), exc_info=traceback.format_exc()))
27+
fire_event(
28+
SQLRunnerException(
29+
exc=str(e), exc_info=traceback.format_exc(), node_info=self.node.node_info
30+
)
31+
)
2832
if isinstance(e, dbt.exceptions.Exception):
2933
if isinstance(e, dbt_common.exceptions.DbtRuntimeError):
3034
e.add_node(ctx.node)

0 commit comments

Comments
 (0)