diff --git a/.gitignore b/.gitignore index 7eafe5c..b702128 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ .tmp .tb_error* tinybird/fixtures - +tinybird/tests/*.yaml diff --git a/tinybird/endpoints/auth0_top_browsers.pipe b/tinybird/endpoints/auth0_top_browsers.pipe new file mode 100644 index 0000000..21e91d5 --- /dev/null +++ b/tinybird/endpoints/auth0_top_browsers.pipe @@ -0,0 +1,42 @@ +NODE extract_browser +SQL > + + % + SELECT + case + when match(event.data.user_agent::String, '(?i)firefox') + then 'Firefox' + when match(event.data.user_agent::String, '(?i)chrome|crios') + then 'Chrome' + when match(event.data.user_agent::String, '(?i)opera') + then 'Opera' + when match(event.data.user_agent::String, '(?i)msie|trident') + then 'Internet Explorer' + when match(event.data.user_agent::String, '(?i)iphone|ipad|safari') + then 'Safari' + else 'Unknown' + END as browser, + count(*) as request_count + FROM auth0 + WHERE 1 + AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}} + AND event_time <= {{DateTime(date_to, '2026-01-01 23:59:59')}} + AND event.data.user_agent IS NOT NULL + {% if defined(event_type) %} + AND event_type = {{String(event_type)}} + {% end %} + {% if defined(client_name) %} + AND event.data.client_name::String = {{String(client_name)}} + {% end %} + {% if defined(connection_id) %} + AND event.data.connection_id::String = {{String(connection_id)}} + {% end %} + {% if defined(tenant_name) %} + AND event.data.tenant_name::String = {{String(tenant_name)}} + {% end %} + AND browser != 'Unknown' + GROUP BY browser + ORDER BY request_count DESC + LIMIT 10 + +TYPE endpoint diff --git a/tinybird/pipes/auth0_apis.pipe b/tinybird/pipes/auth0_apis.pipe index 3ae0239..13ff075 100644 --- a/tinybird/pipes/auth0_apis.pipe +++ b/tinybird/pipes/auth0_apis.pipe @@ -27,3 +27,5 @@ SQL > event.data.audience::String ORDER BY total_events DESC + +TYPE endpoint diff --git a/tinybird/pipes/auth0_top_browsers.pipe b/tinybird/pipes/auth0_top_browsers.pipe index 566615d..d438e21 100644 --- a/tinybird/pipes/auth0_top_browsers.pipe +++ b/tinybird/pipes/auth0_top_browsers.pipe @@ -23,7 +23,7 @@ SQL > FROM auth0 WHERE 1 AND event_time >= {{DateTime(date_from, '2024-01-01 00:00:00')}} - AND event_time <= {{DateTime(date_to, '2025-01-01 23:59:59')}} + AND event_time <= {{DateTime(date_to, '2026-01-01 23:59:59')}} AND event.data.user_agent IS NOT NULL {% if defined(event_type) %} AND event_type = {{String(event_type)}} @@ -37,6 +37,9 @@ SQL > {% if defined(tenant_name) %} AND event.data.tenant_name::String = {{String(tenant_name)}} {% end %} + AND browser != 'Unknown' GROUP BY browser ORDER BY request_count DESC - LIMIT 10 \ No newline at end of file + LIMIT 10 + +TYPE endpoint \ No newline at end of file diff --git a/tinybird/pipes/pagerduty_incidents_over_time.pipe b/tinybird/pipes/pagerduty_incidents_over_time.pipe index 5911be2..c13365d 100644 --- a/tinybird/pipes/pagerduty_incidents_over_time.pipe +++ b/tinybird/pipes/pagerduty_incidents_over_time.pipe @@ -9,7 +9,7 @@ SQL > SELECT 0 AS number UNION ALL SELECT number + 1 - FROM system.numbers + FROM numbers(100) WHERE number < dateDiff('hour', toStartOfHour(toDateTime({{DateTime(date_from, '2024-01-01 00:00:00')}})), toStartOfHour(toDateTime({{DateTime(date_to, '2024-12-31 23:59:59')}}))) ) SELECT addHours(toStartOfHour(toDateTime({{DateTime(date_from, '2024-01-01 00:00:00')}})), number) as hour diff --git a/tinybird/pipes/pagerduty_interruptions.pipe b/tinybird/pipes/pagerduty_interruptions.pipe index f26bed3..480b566 100644 --- a/tinybird/pipes/pagerduty_interruptions.pipe +++ b/tinybird/pipes/pagerduty_interruptions.pipe @@ -9,7 +9,7 @@ SQL > SELECT 0 AS number UNION ALL SELECT number + 1 - FROM system.numbers + FROM numbers(100) WHERE number < dateDiff('day', toDate(toDateTime({{DateTime(date_from, '2024-01-01 00:00:00')}})), toDate(toDateTime({{DateTime(date_to, '2024-12-31 23:59:59')}}))) ) SELECT addDays(toDate(toDateTime({{DateTime(date_from, '2024-01-01 00:00:00')}})), number) as day