mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2026-01-06 08:49:53 -06:00
Feat: Events in the OLAP Repo (#1707)
* Revert "Revert "Feat: Events in the OLAP Repo (#1633)" (#1706)"
This reverts commit bf29269a27.
* Feat: Events Frontend (#1678)
* feat: add events tables
* fix: tweak PK
* feat: migration
* feat: gen models
* fix: add external id col + index
* fix: uuid pk
* fix: types
* chore: gen
* feat: add index
* Feat: Write events into OLAP tables (#1634)
* feat: query for event creation
* feat: olap impl
* feat: wire up the olap event write
* feat: goroutine?
* feat: start wiring up inserts to triggers
* fix: no `RETURNING`
* fix: hack
* fix: inner join
* feat: attempt 2
* fix: return errors
* chore: lint
* fix: diff
* feat: add new partitions
* fix: eof
* fix: write external ids into table
* chore: gen
* fix: wiring
* fix: event deduping
* fix: insert in bulk
* fix: bug
* refactor: return type of trigger
* fix: unnest ids
* fix: unnest tenant ids
* fix: run ids in bulk insert
* feat: two bulk inserts, one tx
* fix: cruft
* fix: bug
* Update pkg/repository/v1/olap.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: rework to avoid n^2 loop
* fix: transaction timeout
* fix: lint
* fix: use error
* fix: rm penultimate version
* fix: rm penultimate test part ii
* Feat: CEL-based filtering of events (#1676)
* feat: add optional expression to workflow trigger event ref
* feat: proto field for expression
* feat: write and parse the expression
* feat: wire up through put workflow ver request
* feat: query
* fix: naming
* fix: cleanup
* fix: rebase
* Update pkg/repository/v1/trigger.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: skip workflow on cel eval failure
* fix: zero value
* fix: cel evaluator
* fix: usage
* fix: naming + type
* fix: rm event filter from v0 defn
* feat: tests + fix typing
* fix: usage
* fix: construct input
* feat: always write events
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: select existing partitions
* feat: add prio to push event request
* feat: priority from pushed events
* fix: missed a spot
* fix: write events even if they're not tied to any workflows
* fix: revert cel event filtering
* fix: couple more
* fix: simplify
* feat: initial API work
* chore: gen ts
* feat: fe skeleton
* feat: wiring up skeleton data
* feat: hook
* fix: bugs
* fix: lint on gen
* fix: couple more
* feat: wire up counts
* feat: initial events cols + styling
* feat: layout
* feat: styling
* fix: cleanup
* feat: use external ids on the FE
* fix: separate openapi spec for new events route
* fix: required param
* fix: update queries and api
* feat: event detail
* fix: page
* fix: rebase
* tweak: table
* feat: add events page to sidebar
* feat: modify queries to allow fetching by triggering event
* feat: add triggering event id to api
* chore: lint
* feat: wire up events api
* fix: rm log
* fix: gen
* feat: wire up status counts
* fix: rm time series
* fix: rm state
* fix: lint
* fix: eof
* chore: lint
* feat: wire up filters
* fix: lint
* chore: api gen
* feat: add events tables
* fix: tweak PK
* feat: migration
* feat: gen models
* fix: add external id col + index
* fix: uuid pk
* fix: types
* chore: gen
* feat: add index
* Feat: Write events into OLAP tables (#1634)
* feat: query for event creation
* feat: olap impl
* feat: wire up the olap event write
* feat: goroutine?
* feat: start wiring up inserts to triggers
* fix: no `RETURNING`
* fix: hack
* fix: inner join
* feat: attempt 2
* fix: return errors
* chore: lint
* fix: diff
* feat: add new partitions
* fix: eof
* fix: write external ids into table
* chore: gen
* fix: wiring
* fix: event deduping
* fix: insert in bulk
* fix: bug
* refactor: return type of trigger
* fix: unnest ids
* fix: unnest tenant ids
* fix: run ids in bulk insert
* feat: two bulk inserts, one tx
* fix: cruft
* fix: bug
* Update pkg/repository/v1/olap.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: rework to avoid n^2 loop
* fix: transaction timeout
* fix: lint
* fix: use error
* fix: rm penultimate version
* fix: rm penultimate test part ii
* Feat: CEL-based filtering of events (#1676)
* feat: add optional expression to workflow trigger event ref
* feat: proto field for expression
* feat: write and parse the expression
* feat: wire up through put workflow ver request
* feat: query
* fix: naming
* fix: cleanup
* fix: rebase
* Update pkg/repository/v1/trigger.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: skip workflow on cel eval failure
* fix: zero value
* fix: cel evaluator
* fix: usage
* fix: naming + type
* fix: rm event filter from v0 defn
* feat: tests + fix typing
* fix: usage
* fix: construct input
* feat: always write events
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: select existing partitions
* feat: add prio to push event request
* feat: priority from pushed events
* fix: missed a spot
* fix: write events even if they're not tied to any workflows
* fix: revert cel event filtering
* fix: couple more
* fix: simplify
* fix: gen api
* fix: gen
* fix: more merge issues
* chore: gen
* fix: lockfile
* fix: merge issues
* chore: gen again
* fix: rm unused fields from openapi spec
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix: migration ver
* fix: insert trigger, event types
* fix: bunch o refs
* fix: migration
* fix: queries
* fix: finish wiring up inserts
* fix: misc bugs
* fix: fe filtering
* chore: lint
* fix: formatting, gen
* fix: current_date
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -53,6 +53,42 @@ BEGIN
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE OR REPLACE FUNCTION create_v1_weekly_range_partition(
|
||||
targetTableName text,
|
||||
targetDate date
|
||||
) RETURNS integer
|
||||
LANGUAGE plpgsql AS
|
||||
$$
|
||||
DECLARE
|
||||
targetDateStr varchar;
|
||||
targetDatePlusOneWeekStr varchar;
|
||||
newTableName varchar;
|
||||
BEGIN
|
||||
SELECT to_char(date_trunc('week', targetDate), 'YYYYMMDD') INTO targetDateStr;
|
||||
SELECT to_char(date_trunc('week', targetDate) + INTERVAL '1 week', 'YYYYMMDD') INTO targetDatePlusOneWeekStr;
|
||||
SELECT lower(format('%s_%s', targetTableName, targetDateStr)) INTO newTableName;
|
||||
-- exit if the table exists
|
||||
IF EXISTS (SELECT 1 FROM pg_tables WHERE tablename = newTableName) THEN
|
||||
RETURN 0;
|
||||
END IF;
|
||||
|
||||
EXECUTE
|
||||
format('CREATE TABLE %s (LIKE %s INCLUDING INDEXES)', newTableName, targetTableName);
|
||||
EXECUTE
|
||||
format('ALTER TABLE %s SET (
|
||||
autovacuum_vacuum_scale_factor = ''0.1'',
|
||||
autovacuum_analyze_scale_factor=''0.05'',
|
||||
autovacuum_vacuum_threshold=''25'',
|
||||
autovacuum_analyze_threshold=''25'',
|
||||
autovacuum_vacuum_cost_delay=''10'',
|
||||
autovacuum_vacuum_cost_limit=''1000''
|
||||
)', newTableName);
|
||||
EXECUTE
|
||||
format('ALTER TABLE %s ATTACH PARTITION %s FOR VALUES FROM (''%s'') TO (''%s'')', targetTableName, newTableName, targetDateStr, targetDatePlusOneWeekStr);
|
||||
RETURN 1;
|
||||
END;
|
||||
$$;
|
||||
|
||||
-- https://stackoverflow.com/questions/8137112/unnest-array-by-one-level
|
||||
CREATE OR REPLACE FUNCTION unnest_nd_1d(a anyarray, OUT a_1d anyarray)
|
||||
RETURNS SETOF anyarray
|
||||
|
||||
Reference in New Issue
Block a user