-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clarified observability dashboard (et/somenergia-jardiner!139)
Merge branch 'fix/observabilitat' into 'main'
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
18 changes: 18 additions & 0 deletions
18
dbt_jardiner/models/jardiner/observability/dset/obs_dset_responses__expected_signals.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{ config(materialized="view") }} | ||
|
||
|
||
with esperades as ( | ||
select * | ||
from {{ ref("dm_dset_last_reading__from_signal_last_ts") }} | ||
where uuid_senyal is not null | ||
) | ||
select | ||
nom_planta, | ||
count(*) as senyals_esperades, | ||
count(*) filter (where ultim_ts is null) as no_rebudes_mai, | ||
count(*) filter (where ultim_ts is not null) as rebudes_alguna_vegada, | ||
count(*) filter (where ultim_ts is not null and ultim_ts >= current_date) as rebudes_avui, | ||
count(*) filter (where ultim_ts is not null and ultim_ts < current_date) as no_rebudes_avui, | ||
count(*) filter (where ultim_ts is null or (ultim_ts is not null and ultim_ts < current_date)) as no_rebudes_total | ||
from esperades | ||
group by nom_planta |
11 changes: 11 additions & 0 deletions
11
dbt_jardiner/models/jardiner/observability/dset/obs_dset_responses__unexpected_signals.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{{ config(materialized="view") }} | ||
|
||
|
||
with inesperades as ( | ||
select * | ||
from {{ ref("dm_dset_last_reading__from_signal_last_ts") }} | ||
where uuid_senyal is null | ||
) | ||
select nom_planta_dset, count(*) as senyals_inesperades | ||
from inesperades | ||
group by nom_planta_dset |