Commit Graph

42 Commits

Author SHA1 Message Date
Sean Reilly 31e425a858 lets make retry configurable and do not retry for unavailable because the retry is slower than regular heartbeat (#1046)
Co-authored-by: Sean Reilly <sean@hatchet.run>
2024-11-21 13:39:31 -05:00
abelanger5 197bdd1f88 feat: exponential backoff (#1062)
* initial migration

* feat: exp backoff, fix linting

* fix utc issue and cleanup
2024-11-21 13:39:02 -05:00
Sean Reilly b5de6e26ff Add a dynamic strategy for flushing as a function of currently flushing (#1055)
* add a dynamic strategy for flushing where we make the trigger for flush a funciton of the depth of the concurrency

* default value for tests and New for FlushStrategy

* clean up the currently flushing locking and add deadlock.Mutex

* don't wait as long for the buffer

* lets see if this 2ms thing is what is causing things to break

* lets error for this to see if we are actually hitting these limits

* put a really short deadline on the lock timeout to see if github actions will blow up

* lets use RW mutexs se we don't block as much

* lets extend this out to 100ms

* lets just do fewer locks

* add a lock to prevent a queue behind the semaphore

* deal with potential data races

* a simpler loop fib and now locks

* lets get rid of the wait for flush

* remove the deadlock stuff

* mod tidy

---------

Co-authored-by: Sean Reilly <sean@hatchet.run>
2024-11-20 19:49:30 +00:00
Gabe Ruttner 4eaa9e7fd9 feat: configurable internal retry (#1049)
* feat: configurable internal retry

* fix: bump default to 3
2024-11-15 09:19:24 -05:00
Gabe Ruttner 3850964a98 feat: initial doc pages (#1020)
* generate initial cloud client

* feat: initial doc pages

* feat: cloud register id, action filtering

* feat:cloud register

* fix: env var

* chore:lint

---------

Co-authored-by: Alexander Belanger <alexander@hatchet.run>
2024-11-08 07:46:43 -08:00
Sean Reilly b456382429 add multiple rate limiter in grpc using a token bucket (#984)
* add multiple rate limiter in grpc using a token bucket

* PR feedback

* add in client retry for go client

* update test files

* remove log line only retry on ResourceExhausted and Unavailable

* add some concurrency limits so we don't swamp ourselves

* add some logging for when we are getting backed up

* lets not queue up when we are too full to prevent OOM problems

* fix spelling

* add config options for maximum concurrent and how long to wait for flush , let the wait for flush setting be used as back pressure and a signal to writers that we are slowing up

* lots of changes to buffering

* fix data race

* add some comments explaing how this works, change errors to be ResourceExhausted now that we have client retry and limit how many gofuncs we can create on cleanup and wait for them to finish before we exit

* hooking up the config values so they go to the right place

* Update config.go to default to 1 ms waitForFlush

* disable grpc_retry for client streams

* explicitly set the limit if it is 0

* weirdness because we were using an older version of the lib

---------

Co-authored-by: Sean Reilly <sean@hatchet.run>
Co-authored-by: Alexander Belanger <alexander@hatchet.run>
2024-11-01 11:48:23 +00:00
Sean Reilly 7d5b41b082 add an essential pool for heatbeats (#1003)
* add an essential pool for heatbeats

* add some telemetry spans to heartbeat and capture any errors

---------

Co-authored-by: Sean Reilly <sean@hatchet.run>
2024-11-01 07:09:45 -04:00
Sean Reilly ea682f5c6b Feat concurrency limit for flush (#991)
* add some concurrency limits so we don't swamp ourselves

* lets not queue up when we are too full to prevent OOM problems

* add config options for maximum concurrent and how long to wait for flush , let the wait for flush setting be used as back pressure and a signal to writers that we are slowing up


---------

Co-authored-by: Sean Reilly <sean@hatchet.run>
2024-10-31 09:43:21 -07:00
abelanger5 a9936ef687 fix: set otel insecure flag for all telemetry instantiations (#999) 2024-10-30 17:34:36 -04:00
abelanger5 6158aa2a4c feat: docs for performance (#997)
* feat: docs for performance

* wrap up perf doc

* address review comments
2024-10-29 18:29:03 -04:00
Sean Reilly 9f4b63817d add a serial write for step run events (#990)
* add a serial write for step run events

* update other problematic queries

* tmp: don't upsert queue

* add SerialBuffer to the config

* revert the change to config

* fix: add back queue upsert

* add statement timeout to upsert queue

---------

Co-authored-by: Sean Reilly <sean@hatchet.run>
Co-authored-by: Alexander Belanger <alexander@hatchet.run>
2024-10-25 16:56:38 +00:00
abelanger5 2cdee59aea refactor: optimize v0.50.0 release (#975)
- Simplifies architecture for splitting engine services into different components. The three supported services are now `grpc-api`, `scheduler`, and `controllers`. The `grpc-api` service is the only one which needs to be exposed for workers. The other two can run as unexposed services.
- Fixes a set of bugs and race conditions in the `v2` scheduler
- Adds a `lastActive` time to the `Queue` table and includes a migration which sets this `lastActive` time for the most recent 24 hours of queues. Effectively this means that the max scheduling time in a queue is 24 hours. 
- Rewrites the `ListWorkflowsForEvent` query to improve performance and select far fewer rows.
2024-10-23 12:05:16 +00:00
abelanger5 67a96d7166 feat(throughput): single process per queue (#956)
* feat(throughput): single process per queue

* fix data race

* fix: golint and data race on load test

* wrap up initial v2 scheduler

* fix: more debug logs and tighten channel logic/blocking sends

* improved casing on dispatcher and lease manager

* fix: data race on min id

* increase wait on load test, fix data race

* fix: trylock -> lock

* clean up queue when no longer in set

* fix: clean up cache on exit

* ensure cleanup is only called once

* address review comments
2024-10-15 11:05:19 -04:00
Sean Reilly 29721cd1f0 Feat bulk workflows (#940)
Adds support for inserting workflows in bulk via the API and an optional buffered insert on the engine.
2024-10-14 15:35:29 -04:00
abelanger5 95558138a4 chore: improve throughput, remove deadlocks (#949)
* add otel to pub

* temporarily remove tenant id exchange

* fix: increase internal queue throughput

* fix: remove potential deadlocking

* rollback hash factor multiplier

* fix: batch update issues

* fix: rm unneeded locks

* move disable tenant pubsub to an env var

---------

Co-authored-by: gabriel ruttner <gabriel.ruttner@gmail.com>
2024-10-10 08:54:34 -04:00
abelanger5 3d218302ff fix: internal queue items performance and race conditions (#943)
* fix: don't use xmin hack

* fix: assign not append

* refactor: parallel step run updates via hashes

* fix: intermittent double execution of child step runs

* fix: rollback rate limits

* fix: bulk event writes from single buffer

* expose cleanup

* fix: race conditions on failures and cancellations

* change logger defaults to warn and console
2024-10-07 11:16:53 -04:00
abelanger5 7b5bb398e4 improvements to conn pooling (#939)
* attempt improvements to conn pooling

* cleanup PR
2024-10-04 15:23:34 -04:00
abelanger5 fd4ee804d3 refactor: buffered writes of step run statuses (#941)
* (wip) handle step run updates without deferred updates

* refactor: buffered writes of step run statuses

* fix: add more safety on tenant pools

* add configurable flush period, remove wait for started

* flush immediately if last flush time plus flush period is in the past

* feat: add configurable flush internal/max items
2024-10-04 15:08:21 -04:00
Sean Reilly 27736fa30f bulk insert buffering (#913)
Adds bulk inserts to event writes, and adds a generic buffer which can be used by future batch implementations.
2024-10-03 16:26:12 -04:00
abelanger5 bfb11cac51 fix: always use retention on queues, optional data/worker (#916) 2024-09-27 14:23:14 -04:00
abelanger5 6172956bbd refactor: remove foreign keys from unchanged/non-cascading parent tables (#918)
* refactor: remove fks from unchanged/non-cascading parent tables

* fix: cleanup cache for engine repository

* fix: remove streamevent
2024-09-27 14:21:45 -04:00
abelanger5 9efcebe6af fix: better logic for multiple restricted domains (#860) 2024-09-10 12:07:55 -04:00
abelanger5 7308876776 fix: use separate database pool for queueing, statement timeouts on tx (#839)
* fix: different queue pool and statement timeouts on step runs

* fix: implement prepareTx

* fix: defer rollback properly

* fix: race condition
2024-09-03 21:07:26 +00:00
abelanger5 b5014f6b3d chore: more visibility and debug lines for queues (#836)
* chore: more visibility and debug options for queues

* better debug lines on queue repo

* don't log so much in load test
2024-08-29 14:49:24 -04:00
abelanger5 17b7e84876 fix: delete queue items when no longer used (#831) 2024-08-28 17:12:31 -04:00
Gabe Ruttner 4ea4712d4d refactor: performance and throughput (#756)
Refactors the queueing logic to be fairly balanced between actions, with each action backed as a separate FIFO queue. Also adds support for priority queueing and custom queues, though those aren't exposed on the API layer yet. Improves throughput to be > 5000 tasks/second on a single queue. 

---------

Co-authored-by: Alexander Belanger <alexander@hatchet.run>
2024-08-12 14:38:47 +00:00
abelanger5 652f604873 fix: add max msg size as env var (#759) 2024-08-01 09:25:05 -04:00
Gabe Ruttner b4670af138 Fix qos otel config (#754)
* feat: otel trace id ratio

* feat: rabbitmq qos

* feat: requeue limit

* fix: tests
2024-07-30 18:11:10 -04:00
abelanger5 aafdd278db make max msg size configurable (#745) 2024-07-26 10:58:16 -07:00
Gabe Ruttner b7cec9ec53 feat: soft delete (#717)
* feat: soft delete workflows and versions

* feat: filter soft deletes wf and wfr

* feat: filter events and step runs

* fix: query

* fix: query

* chore: generate

* wip

* chore: squash migrations

* chore: separate retention into new service

* feat: regularly clean up

* chore: migrations

* fix: tests

* fix: queries

* fix: ambiguous

* fix: refs

* fix: ambiguous id

* fix: remove update from

* fix: soft delete

* fix: cleanup retention scheduler

* fix: has more query

* chore: gen

* fix: query

* fix: table
2024-07-18 09:06:05 -04:00
Gabe Ruttner 1e20bf946a fix: improved assign, reassign, and requeue (#702)
* fix: improved queries

* fix: 1s timeout

* fix: indexes

* fix: increase timeout to 4s

* fix: migration

* merge in db changes

* chore: squash migrations

* chore: re-hash

* chore: remove comment

* chore: rm unused query

* fix: state

* fix: check valid workers before commit

* fix: query

* chore: gen
2024-07-10 12:45:08 -04:00
abelanger5 f36e66cd28 feat: configurable data retention period (#693)
* feat: data retention for tenants

* chore: generate and docs

* chore: lint
2024-07-06 14:31:12 +00:00
abelanger5 f2c6bc1f44 feat: tenant partitioning (#649)
* feat: tenant partitioning

* fix: rebalance inactive partitions, split into separate partitioner

* fix: shutdown partitioner scheduler properly

* update config options

* fix: config options linting
2024-06-26 21:06:51 +00:00
Gabe Ruttner a8d42819ea feat: check security service (#639)
* feat: check security service

* feat: propegate version

* feat: with ident

* fix: lint

* chore: generate

* fix: change domain

* fix: panic recover

* fix: migrations

* fix: hash

* fix: dont check in tests
2024-06-26 16:26:29 -04:00
Gabe Ruttner 35979bea68 feat: disable signups (#643)
* feat: disable signups

* feat: ui and password

* merge main

* fix: disable allow oauth
2024-06-26 16:12:40 -04:00
abelanger5 39eeed04a5 fix: correct alarm limit vars (#645) 2024-06-26 14:44:41 +00:00
Luca Steeb 1490d88954 feat: webhook workers (#542)
Adds serverless support via the concept of webhook workers. Allows any webhook to be registered as a serverless endpoint for executing a step.
2024-06-25 17:06:43 -04:00
Gabe Ruttner 697757879f feat: billing (#624)
* feat: init lago client

* feat: billable meter

* feat: db persistence

* wip: expose sub

* feat: rename page

* wip: billing section

* wip: lago integration

* feat: separate plan and period

* wip: webhook

* feat: improve empty state

* feat: update limits on plan changes

* feat: can change plans

* feat: change plan loading state

* feat: yearly filter

* feat: billing clarification

* fix: treatment

* feat: filter plans

* feat: prevent non-owner from changing plan

* fix: loading state

* fix: jit portal link

* fix: rm import

* fix: build errors

* fix: default to free

* fix: wrong files

* fix: select or insert customer

* fix: note

* feat: upgrade dependent on payment method state

* fix: dedupe

* chore: remove github-app from core

* chore: port to cloud

* chore: port to cloud

* chore: port to cloud

* chore: port to cloud

* chore: port to cloud

* add new components, repository callbacks

* chore: rm unused packages

* chore: fix generation

* chore: gen

* fix: cloud api references

* debug

* debug

* fix: actually set plans

* chore: rm debug

* fix: build

* feat: callbacks

* fix: add generated code

* chore: group cloud components

* chore: group by feature

* feat: alert change

* feat: confirm

* fix: confirm modal

* fix: ui

* fix: remove arrears

* fix: open in same tab

* fix: wan alert

* fix: call the callback

* fix: callback obj

* fix: disable if no cloud meta

---------

Co-authored-by: Alexander Belanger <alexander@hatchet.run>
2024-06-25 13:57:16 -04:00
abelanger5 771054a401 fix: make rabbitmq connection optional and disable for token generation (#635) 2024-06-25 15:53:55 +00:00
Luca Steeb b6dcb4e7e9 refactor(random): refactor random string generation (#633) 2024-06-24 23:44:03 +01:00
Gabe Ruttner ba7eb72f24 Feat dynamic limits (#632)
* chore: port from feature branch

* feat: can set limit map

* chore: generate
2024-06-24 11:38:01 -07:00
abelanger5 7c3ddfca32 feat: api server extensions (#614)
* feat: allow extending the api server

* chore: remove internal packages to pkg

* chore: update db_gen.go

* fix: expose auth

* fix: move logger to pkg

* fix: don't generate gitignore for prisma client

* fix: allow extensions to register their own api spec

* feat: expose pool on server config

* fix: nil pointer exception on empty opts

* fix: run.go file
2024-06-19 09:36:13 -04:00