Skip to content

[Backport 1.13.latest] Relay v2 parser output via otel log format for output parity - #16373

Merged
tauhid621 merged 1 commit into
1.13.latestfrom
backport-16325-to-1.13.latest
Sep 21, 2026
Merged

tauhid621 merged 1 commit into
1.13.latestfrom
backport-16325-to-1.13.latest

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport 594ee2a from #16325.

* fix(v2-parser): relay fusion parser output via otel log format for v2 parity

The subprocess relay for `--use-v2-parser` shelled out with `--log-format
json` and forwarded every line as a flat, unstructured Note event,
producing duplicate banners, per-node span noise, and losing the
original fusion error/warning codes.

Switch to `--log-format otel` and parse the JSONL envelope (SpanStart/
SpanEnd/LogRecord). Spans are dropped unconditionally, which structurally
eliminates the span-derived noise without a hand-maintained denylist.
Only an allowlist of LogRecord event types is relayed: LogMessage and
UserLogMessage relay their body (with the fusion error/warning code
composed back into the message text), StdoutMessage/StderrMessage relay
as-is, and ProgressMessage is rendered v1-side to reproduce fusion's
"{action} {target} ({description})" formatting. Severity is mapped from
the OTLP severity_number onto dbt-core's EventLevel.

Unparseable or unrecognized lines now relay at INFO instead of WARN,
fixing a latent bug where a stray fusion stderr line could get promoted
to a raised EventCompilationError under --warn-error and abort the run.

Also forward --log-level-file off. The v2 parser defaults its file log to
{--project-dir}/logs/dbt.log, which is the same path dbt-core writes its
own file log to when --log-path isn't redirected, so both processes were
appending the same relayed events to one file. Everything the subprocess
emits already reaches dbt-core over stdout and lands in dbt.log through
dbt-core's own logger.

* Narrow severity_number type instead of silencing mypy

The `# type: ignore[arg-type]` only covered one of the codes mypy emits for
int(object) depending on version, so it failed under mantle's mypy with
call-overload. An isinstance narrow needs no ignore and keeps the relay
identical between dbt-core and mantle.

* Relay the v2 parser's end-of-run status line

The status line ('Finished 'parse' with N warnings and M errors') has no
LogRecord of its own: the v2 parser renders it in its console formatter
out of Invocation span-end attributes. The relay dropped every span
wholesale, so the line went missing from --use-v2-parser output.

Read the aggregate counts off the Invocation span end instead, and
re-render the line with dbt-core's own ui color helpers. Every other span
is still dropped.

* Drop StdoutMessage/StderrMessage from the relay allowlist

These event types exist for console output only and are not intended to
reach the otel stream, so allowlisting them for forward-compatibility was
speculative. Restore the TODO about switching to the Python OTel decoding
library once it is released.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 594ee2a)
@github-actions
github-actions Bot requested a review from a team as a code owner September 18, 2026 20:33
@cla-bot cla-bot Bot added the cla:yes label Sep 18, 2026
@tauhid621
tauhid621 merged commit b3a1c7f into 1.13.latest Sep 21, 2026
139 of 140 checks passed
@tauhid621
tauhid621 deleted the backport-16325-to-1.13.latest branch September 21, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants