Skip to content

feat: Add post-parse model configuration telemetry - #1665

Open
saishreeeee wants to merge 13 commits into
databricks:1.13.latestfrom
saishreeeee:wire-model-config-telemetry
Open

feat: Add post-parse model configuration telemetry#1665
saishreeeee wants to merge 13 commits into
databricks:1.13.latestfrom
saishreeeee:wire-model-config-telemetry

Conversation

@saishreeeee

@saishreeeee saishreeeee commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds aggregate model-configuration statistics to the existing opt-in POST_PARSE telemetry event. The payload now captures:

  • Model scope, materialization, and language counts
  • Incremental strategies and relevant incremental configuration usage
  • Effective storage formats, catalog types, and compute types
  • Python submission methods
  • Selected Databricks model configs and constraints

The values are aggregated counts and do not include model names or configuration values. The post-parse hook supplies catalog resolution through the adapter so effective catalog and storage choices are recorded consistently.

Testing

Ran dbt build with telemetry opted in and manually verified the POST_PARSE and POST_RUN events landed in the dbt telemetry table

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.
  • [Optional] I have run the dbt-databricks-pr-ready project skill for this PR and addressed its merge-readiness feedback

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  dbt/adapters/databricks/telemetry
  builder.py 277-284, 294, 333, 342, 349, 384, 443-444, 465, 509, 584-597
  hooks.py 73-74
  models.py
Project Total  

This report was generated by python-coverage-comment-action

@saishreeeee saishreeeee changed the title Add post-parse model configuration telemetry feat: Add post-parse model configuration telemetry Sep 7, 2026
@saishreeeee saishreeeee self-assigned this Sep 7, 2026
Drop kitchen-sink and kwargs-forwarding coverage that restated collector maps, and retain cases that can fail without a matching production change.
Merge knobs, Z-order, and constraints were inflating adoption for strategies and formats the macros ignore, and v2 catalog_database HMS routing was labeled Unity.
@saishreeeee
saishreeeee marked this pull request as ready for review September 7, 2026 17:07
…emetry

V2 never applies persist_constraints metadata, and CLUSTER BY AUTO is ignored when explicit liquid clustering columns are set.
Match get_model_constraints and get_column_constraints so telemetry does not union legacy meta with contract constraints at the same level.
Count MV contract constraints, streaming-table column NOT NULL and masks, V2 table/incremental masks, and drop V1 Python-table auto-liquid and row-filter false positives.
Dedicated CHECK is routed to alter_constraints, which the MV path never applies; keep NOT NULL, PK, FK, and CUSTOM.
Keep only contracts that can fail without rewriting the collector maps, and remove lookup-table and default-forwarding cases.
Comment thread dbt/adapters/databricks/telemetry/builder.py
Stop predicting runtime applicability so POST_PARSE reports configured intent, including conflicts; keep resolution on effective_* fields.
@saishreeeee
saishreeeee requested a review from sd-db September 11, 2026 04:24
def _constraint_configs(node: Any) -> set[models.ModelConfig]:
constraint_names = _constraint_type_keys(getattr(node, "constraints", None))
meta = getattr(node, "meta", None) or {}
constraint_names.update(_constraint_type_keys(_value(meta, "constraints")))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore the list/tuple check for meta.constraints. dbt accepts arbitrary metadata such as meta: {constraints: true}; this now raises TypeError and silently drops the entire POST_PARSE event. Confirmed against a real parsed manifest; the previous head succeeds. Keep declaration counting unconditional, but ignore unsupported legacy metadata shapes and add a regression test.

assert config.is_eligible_command() is eligible


class TestTransportEligibility:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please retain compact tests for default-off consent, explicit opt-in, and eligible/ineligible commands. The hook tests mock is_enabled_for_invocation, so they don’t cover this boundary.

Comment thread dbt/adapters/databricks/telemetry/builder.py Outdated
}


def _config_usage(node: Any, config: Any) -> set[models.ModelConfig]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a short docstring to _config_usage explaining this intentional boundary? Suggested wording: “POST_PARSE measures resolved configuration intent, so declarations are counted independently of runtime applicability.” Keep effective_* resolution separate. This should help future maintainers avoid reintroducing execution gates.

Arbitrary meta.constraints values were iterable and dropped the whole event.
@saishreeeee
saishreeeee requested a review from sd-db September 11, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants