From 3b7c2816b9e890eb9b0f3bddb1dc501c7e257bbd Mon Sep 17 00:00:00 2001 From: Drew Banin Date: Thu, 16 Sep 2021 13:28:08 -0400 Subject: [PATCH 1/2] (#3804) Add timing and thread info to sources.json artifact --- core/dbt/contracts/results.py | 8 +++++++- .../integration/042_sources_test/test_sources.py | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/core/dbt/contracts/results.py b/core/dbt/contracts/results.py index 843d375c219..b3adfece719 100644 --- a/core/dbt/contracts/results.py +++ b/core/dbt/contracts/results.py @@ -285,6 +285,9 @@ class SourceFreshnessOutput(dbtClassMixin): status: FreshnessStatus criteria: FreshnessThreshold adapter_response: Dict[str, Any] + timing: List[TimingInfo] + thread_id: str + execution_time: float @dataclass @@ -333,7 +336,10 @@ def process_freshness_result( max_loaded_at_time_ago_in_s=result.age, status=result.status, criteria=criteria, - adapter_response=result.adapter_response + adapter_response=result.adapter_response, + timing=result.timing, + thread_id=result.thread_id, + execution_time=result.execution_time, ) diff --git a/test/integration/042_sources_test/test_sources.py b/test/integration/042_sources_test/test_sources.py index c9633e86e41..2f8e2bc87ce 100644 --- a/test/integration/042_sources_test/test_sources.py +++ b/test/integration/042_sources_test/test_sources.py @@ -272,7 +272,21 @@ def _assert_freshness_results(self, path, state): 'warn_after': {'count': 10, 'period': 'hour'}, 'error_after': {'count': 18, 'period': 'hour'}, }, - 'adapter_response': {} + 'adapter_response': {}, + 'thread_id': AnyStringWith('Thread-'), + 'execution_time': AnyFloat(), + 'timing': [ + { + 'name': 'compile', + 'started_at': AnyStringWith(), + 'completed_at': AnyStringWith(), + }, + { + 'name': 'execute', + 'started_at': AnyStringWith(), + 'completed_at': AnyStringWith(), + } + ] } ]) From abb59ef14fd8582aadf67da6ba6f6e4d6779a3ef Mon Sep 17 00:00:00 2001 From: Drew Banin Date: Thu, 16 Sep 2021 13:54:04 -0400 Subject: [PATCH 2/2] add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 014e82fa705..eb9a46ab9b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Add support for execution project on BigQuery through profile configuration ([#3707](https://github.com/dbt-labs/dbt/issues/3707), [#3708](https://github.com/dbt-labs/dbt/issues/3708)) - Skip downstream nodes during the `build` task when a test fails. ([#3597](https://github.com/dbt-labs/dbt/issues/3597), [#3792](https://github.com/dbt-labs/dbt/pull/3792)) - Added default field in the `selectors.yml` to allow user to define default selector ([#3448](https://github.com/dbt-labs/dbt/issues/3448#issuecomment-907611470)) +- Added timing and thread information to sources.json artifact ([#3804](https://github.com/dbt-labs/dbt/issues/3804), [#3894](https://github.com/dbt-labs/dbt/pull/3894)) ### Fixes