mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-25 13:02:15 +03:00
36 lines
1.3 KiB
Plaintext
36 lines
1.3 KiB
Plaintext
|
INCLUDE "../includes/timeSeries.incl"
|
||
|
|
||
|
NODE timeSeriesServerlessFunctionDurationData
|
||
|
SQL >
|
||
|
%
|
||
|
SELECT
|
||
|
{% if granularity == "hour" %} toStartOfHour(timestamp, {{ String(timezone, 'UTC') }})
|
||
|
{% elif granularity == "custom" %}
|
||
|
toDateTime64(
|
||
|
toStartOfMinute(timestamp, {{ String(timezone, 'UTC') }}),
|
||
|
3,
|
||
|
{{ String(timezone, 'UTC') }}
|
||
|
)
|
||
|
{% else %} toDateTime64(toStartOfDay(timestamp, {{ String(timezone, 'UTC') }}), 3)
|
||
|
{% end %} AS interval,
|
||
|
avg(CAST(durationInMs AS Float64)) as average,
|
||
|
min(durationInMs) as minimum,
|
||
|
max(durationInMs) as maximum
|
||
|
FROM serverlessFunctionEventMV
|
||
|
WHERE
|
||
|
true
|
||
|
AND functionId = {{ String(functionId, 'a9fd87c0-af86-4e17-be3a-a6d3d961678a', required=True) }}
|
||
|
AND workspaceId
|
||
|
={{ String(workspaceId, '20202020-1c25-4d02-bf25-6aeccf7ea419', required=True) }}
|
||
|
AND timestamp >= {{ DateTime(start, '2024-10-22 00:00:00') }}
|
||
|
AND timestamp < {{ DateTime(end, '2024-10-23 00:00:00') }}
|
||
|
GROUP BY interval
|
||
|
ORDER BY interval
|
||
|
|
||
|
NODE endpoint
|
||
|
SQL >
|
||
|
%
|
||
|
SELECT formatDateTime(interval, '%FT%T.000%z') as start, minimum, maximum, average
|
||
|
FROM selectIntervalByGranularity
|
||
|
LEFT JOIN timeSeriesServerlessFunctionDurationData USING interval
|