Add module-level tracer and exception span recording - #6
Draft
sfc-gh-ppruett wants to merge 1 commit into
Draft
sfc-gh-ppruett wants to merge 1 commit into
sfc-gh-ppruett wants to merge 1 commit into
Conversation
- jinja.py: moved the dbt.runner tracer from MacroGenerator.__init__ to module level, so it's created once at import instead of once per macro call. - runnable.py: record the exception on the node span in call_runner's exception path. When run_with_hooks raises (result is None), the span now gets StatusCode.ERROR and record_exception(thread_exception) before _handle_thread_exception, so failed nodes carry the exception instead of an unset status. When OTel is disabled the span is INVALID_SPAN and both calls are no-ops. Add test_call_runner_exception_records_on_span covering the new span error status and exception event.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Addresses the two outstanding human-reviewer (tauhid621) comments on the OpenTelemetry work.
jinja.py— moved thedbt.runnertracer fromMacroGenerator.__init__to module level, so it's created once at import instead of once per macro call. Behavior is unchanged; the tracer is still inert until the--snowflake-projects-otelgate opens a span in__call__.runnable.py— record the exception on the node span incall_runner's exception path. Whenrun_with_hooksraises (result isNone), the span now getsStatusCode.ERRORandrecord_exception(thread_exception)before_handle_thread_exception, so failed nodes carry the exception. When OTel is disabled the span isINVALID_SPANand both calls are no-ops.Testing
test_call_runner_exception_records_on_spancovering the new span error status and exception event.buildemitted the expected node + hook spans (the module-level tracer change is exercised by the hook spans), and a deliberately-failing model confirmed node spans getERRORstatus.get_supported_languagesis pre-existing upstream, unrelated to this diff).🤖 Generated with Claude Code