{# "Top Cost Drivers with Issues Found" — same `ui-table` style as governor_web/_cost_drivers_table.html, with a server-side click-to-sort engine: each header is an that flips direction if the column is already active. Filters to jobs with ``issue_count > 0`` so only flagged rows show up. #} {% set _sort = sort_by | default('spend') %} {% set _dir = sort_dir | default('desc') %} {# Macro: render a sortable column header. Toggling the active column flips direction; switching columns resets to desc. Always returns page=1 so users don't end up past the new tail. #} {% macro _sort_th(col, label, align="left", extra="") %} {% set is_active = (_sort == col) %} {% set next_dir = 'asc' if (is_active and _dir == 'desc') else 'desc' %} {% set arrow = '↓' if (is_active and _dir == 'desc') else ('↑' if is_active else '') %} {{ label }} {% if arrow %}{{ arrow }}{% endif %} {% endmacro %}

Top Cost Drivers with Issues Found

Jobs flagged by detection rules · click any column header to sort · click a row to view the full SQL

{{ pagination.total_items }} flagged of {{ "{:,}".format(totals.total_jobs) }} cached

{% if table_jobs %}
{{ _sort_th('destination', 'Destination', 'left') }} {{ _sort_th('spend', 'Spend', 'left') }} {{ _sort_th('bytes', 'Bytes', 'right') }} {{ _sort_th('slot_time', 'Slot Time (hrs)', 'right') }} {{ _sort_th('issues', 'Issues', 'right') }} {{ _sort_th('workload', 'Workload', 'left') }} {{ _sort_th('source', 'Source', 'left') }} {{ _sort_th('run_at', 'Run At', 'right') }} {% for j in table_jobs %} {% endfor %}
{{ j.destination_short }} {% if j.statement_type %} {{ j.statement_type }} {% endif %}
{{ j.cost_usd | format_usd }} {{ "%.1f" | format(j.cost_share_pct) }}%
{{ j.bytes_processed | format_bytes }} {{ "%.1f" | format((j.slot_time_ms or 0) / 3600000) }} {% if j.issue_count > 0 %} {{ j.issue_count }} {% else %} 0 {% endif %} {% if j.workload_kind == "build" %} build {% elif j.workload_kind == "consumption" %} consumption {% else %} other {% endif %} {% if j.is_dbt_originated %} dbt {% else %} other {% endif %} {% if j.creation_time %} {{ j.creation_time.strftime("%Y-%m-%d %H:%M") }} UTC {% else %} — {% endif %}
{% include "dashboard/_pagination.html" %} {% else %}

No flagged jobs in the cached scan. Run the detection engine over more queries or relax the rule overrides.

{% endif %}