0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00
Commit Graph

18 Commits

Author SHA1 Message Date
Tiina Turban
c1fc51cae1
chore: Update capabilities.test.ts (#17465) 2023-10-13 20:09:57 +02:00
Harry Waye
634472c3ad
fix: plugin mode string check (#16490)
* fix: plugin mode string check

Previously we had to keep these in sync, but now we can just use the
PluginServerMode enum directly.

* add test
2023-07-11 14:09:28 +00:00
Harry Waye
7ba6fa7148
chore(plugin-server): remove piscina workers (#15327)
* chore(plugin-server): remove piscina workers

Using Piscina workers introduces complexity that would rather be
avoided. It does offer the ability to scale work across multiple CPUs,
but we can achieve this via starting multiple processes instead. It may
also provide some protection from deadlocking the worker process, which
I believe Piscina will handle by killing worker processes and
respawning, but we have K8s liveness checks that will also handle this.

This should simplify 1. prom metrics exporting, and 2. using
node-rdkafka.

* remove piscina from package.json

* use createWorker

* wip

* wip

* wip

* wip

* fix export test

* wip

* wip

* fix server stop tests

* wip

* mock process.exit everywhere

* fix health server tests

* Remove collectMetrics

* wip
2023-05-03 14:42:16 +00:00
Harry Waye
f62041a833
refactor(ingestion): pull out topic/groupid from kafka-queue (#14249)
* refactor(ingestion): pull out topic/groupid from kafka-queue

We have `IngestionConsumer` at the moment that holds a lot of complexity
in it regarding topics/groupid/message handlers. This is a step towards
moving that logic out of the `IngestionConsumer`, and making the top
level of the pluginsServer simpler to reason about.

* wip

* wip

* wip

* wip
2023-02-15 14:16:23 +00:00
Yakko Majuri
469057b905
refactor(plugin-server): rename KafkaQueue to IngestionConsumer (#12540)
* refactor(plugin-server): rename KafkaQueue to IngestionConsumer

* fix

* final fix

* welp
2022-11-08 13:44:29 -03:00
Harry Waye
ac5a40f5b2
chore(ingestion): remove graphile as dependency of ingestion pipeline (#12551)
* chore(ingestion): remove graphile as dependency of ingestion pipeline

This allows us to run just the ingestion part of the plugin-server
without needing to perform any graphile operations e.g. creating
connections to the graphile database.

This has the advantage that:

 1. if the graphile database is down, the ingestion pods can still start
    up and will function correctly.
 2. avoids creating a connection pool to the graphile database for each
    ingestion pod, which could be a lot of connections and could cause
    the database to scale.
 3. avoids running the graphile migrations on each ingestion pod, which
    is unnecessary and could cause unnecessary database load.

* wip

* wip

* wip

* wip
2022-11-01 16:01:08 +00:00
Harry Waye
13bca71383
chore(ingestion): remove old graphile bufferJob handling (#12528)
* chore(ingestion): remove old graphile bufferJob handling

This removes the emitting of graphile-worker events from the ingestion
anonymous events path. Note that we still have the graphile worker
running on ingestion, as we need to ensure that we have drained all of
these jobs. I'll handle this by first enabling the topic for all users
on prod then deploying this.

For self hosted I suggest we just go with adding a comment that
anonymous events that have been send to graphile in the meantime will be
lost. Or something else that makes sense.

* fix typing

* remove test
2022-10-31 12:09:20 +00:00
Yakko Majuri
1c2713a7b9
Revert "feat(scheduler): allow spreading scheduled tasks load across the fleet" (#12482)
Revert "feat(scheduler): allow spreading scheduled tasks load across the fleet (#12477)"

This reverts commit 98a14fc7c8.
2022-10-27 15:34:16 -03:00
Yakko Majuri
98a14fc7c8
feat(scheduler): allow spreading scheduled tasks load across the fleet (#12477)
* feat(scheduler): allow spreading scheduled tasks load across the fleet

* update test

* Update plugin-server/src/main/graphile-worker/worker-setup.ts

Co-authored-by: Harry Waye <harry@posthog.com>

* tweaks

Co-authored-by: Harry Waye <harry@posthog.com>
2022-10-27 17:35:45 +00:00
Yakko Majuri
c47a73165a
feat(plugin-server): use graphile-worker crontab (#12242)
* yeet references to redlock

* rename jobs/ to graphile-worker/

* feat(plugin-server): use graphile-worker crontab

* remove debugging

* yeet redlock dependency

* remove legacy test

* Update comment

* Update plugin-server/src/main/pluginsServer.ts

Co-authored-by: Harry Waye <harry@posthog.com>

* address review, update tests

* fix old tests

* testing, testing

* maybe fix sigterm

Co-authored-by: Harry Waye <harry@posthog.com>
2022-10-18 11:44:41 -03:00
Yakko Majuri
53b527dbbe
refactor(graphile-worker): update terminology, clearer capabilities approach for setup (#12203)
* rename legacy references to queue to more appropriate worker terminology

* rename startJobsConsumer -> startGraphileWorker, no-op refactor

* add back enqueue success and failure metrics

* fix mock import

* fix test for good
2022-10-12 10:24:22 -03:00
Yakko Majuri
a34228c49f
refactor: yeet job queues scaffolding in favor of only graphile worker (#12178)
* refactor: rename graphile queue to graphile worker

* refactor: rename job-queues/ to jobs/

* refactor: move graphile-worker to top level jobs/ dir

* refactor: remove references to jobQueueManager

* remove promise from startJobQueueConsumer

* remove job-queue-manager.ts

* remove non-test references to JobQueueBase

* make fs-queue independent from JobQueueBase

* rename FsQueue to MockGraphileWorker

* add missing pauseConsumer method to MockGraphileWorker

* rename fs-queue.ts --> mock-graphile-worker.ts

* delete job-queue-base.ts

* get rid of JobQueue type

* rename graphileQueue --> graphileWorker

* rename JobQueueConsumerControl --> JobsConsumerControl

* remove unused jobs test

* rename startJobQueueConsumer --> startJobsConsumer

* fix tests job imports

* rename jobQueueManager --> graphileWorker in tests

* remove JobQueueManager tests

* fix import

* handle metrics and retries on graphileWorker.enqueue

* minor fix

* Delete buffer.ts

* Revert "Delete buffer.ts"

This reverts commit 40f1761d31.

* add initial test scaffolding

* bring back relevant worker control promises

* fix existing tests

* add tests for graphile worker

* fix exportEvents retries test

* update e2e buffer test
2022-10-11 15:40:34 -03:00
Yakko Majuri
4bce5dfa8a
feat: (bring back) buffer 3.0 again (#10896)
* Revert "Revert "feat: (bring back) buffer 3.0  (#10874)" (#10883)"

This reverts commit e203bc7cfa.

* reduce graphile load
2022-07-20 12:16:13 +00:00
Yakko Majuri
e203bc7cfa
Revert "feat: (bring back) buffer 3.0 (#10874)" (#10883)
This reverts commit 3e772b8614.
2022-07-19 17:50:06 +00:00
Yakko Majuri
3e772b8614
feat: (bring back) buffer 3.0 (#10874)
* Revert "Revert "feat: buffer 3.0 (graphile) (#10735)" (#10802)"

This reverts commit ca8c4d0271.

* add metrics and error tracking
2022-07-19 16:34:07 +00:00
Yakko Majuri
ca8c4d0271
Revert "feat: buffer 3.0 (graphile) (#10735)" (#10802)
This reverts commit 9a2a9046cb.
2022-07-14 18:24:58 +00:00
Yakko Majuri
9a2a9046cb
feat: buffer 3.0 (graphile) (#10735)
* feat: buffer 3.0 (graphile)

* fixes

* test

* address review

* add test for buffer processAt
2022-07-13 11:32:00 +00:00
Michael Matloka
64317238e6
refactor: Eliminate the KAFKA_ENABLED setting (#10059)
* refactor: Eliminate the `KAFKA_ENABLED` setting

* Remove dead code

* Consolidate plugin server test scripts and CI

* Fix CI command

* Remove Celery queues

* Rearrange test directories

* Update import paths
2022-05-30 18:39:33 +00:00