0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
Commit Graph

15 Commits

Author SHA1 Message Date
Xavier Vello
c2550fc76b
chore: use pod name as kafka client ID (#13737)
* chore: use pod name as kafka client ID

* update resetKafka test helper too
2023-01-30 14:08:03 -08:00
Paul D'Ambra
27c69225ec
feat: add the performance events clickhouse schema (#13441)
* feat: add the performance events clickhouse schema

* add support for replication being off

* move and refactor performance events sql file

* with the same kafka columns as other tables

* don't account for replication settings in migration

* update snapshots

* kafka table doesn't have explicit kafka columns

Co-authored-by: Ben White <ben@posthog.com>
2022-12-22 14:01:35 +00:00
Harry Waye
d3f9d865f5
refactor(plugin-server): split out plugin server functionality (#12191)
* refactor(plugin-server): split out plugin server functionality

To get better isolation we want to allow specific functionality to run
in separate pods. We already have the ingestion / async split, but there
are further divides we can make e.g. the cron style scheduler for plugin
server `runEveryMinute` tasks.

* split jobs as well

* Also start Kakfa consumers on processAsyncHandlers

* add status for async

* add runEveryMinute test

* avoid fake timers, just accept slower tests

* make e2e concurrent

* chore: also test ingestion/async split

* increase timeouts

* increase timeouts

* lint

* Add functional tests dir

* fix

* fix

* hack

* hack

* fix

* fix

* fix

* wip

* wip

* wip

* wip

* wip

* fix

* remove concurrency

* remove async-worker mode

* add async-handlers

* wip

* add modes to overrideWithEnv validation

* fix: async-handlers -> exports

* update comment
2022-10-20 09:22:46 +00:00
Tiina Turban
49f3311a65
chore: nuke protobuf fully (#10932) 2022-08-03 15:41:44 +02:00
Yakko Majuri
985148ee7e
feat: buffer 2.0 (#10653)
* feat: buffer 2.0 proposal

* add tests

* prevent infinite retrying

* perf

* updates

* tweaks

* Update latest_migrations.manifest

* Update plugin-server/src/main/ingestion-queues/buffer.ts

* update

* updates

* fix migrations issue

* reliability uopdates

* fix tests

* test fix

* e2e test

* test

* test

* ??

* cleanup
2022-07-08 10:48:25 +00:00
Michael Matloka
b04015f25e
chore(plugin-server): Consume from buffer topic (#10475)
* chore(plugin-server): Consume from buffer topic

* Refactor `posthog` extension for buffering

* Properly form `bufferEvent` and don't throw error

* Add E2E test

* Test buffer more end-to-end and properly

* Put buffer-enabled test in a separate file

* Update each-batch.test.ts

* Test that the event goes through the buffer topic

* Fix formatting

* Refactor out `spyOnKafka()`

* Ensure reliability batching-wise

* Send heartbeats every so often

* Make test less flaky

* Commit offsets if necessary before sleep too

* Update tests

* Use seek-based mechanism (with KafkaJS 2.0.2)

* Add comment to clarify seeking

* Update each-batch.test.ts

* Make minor improvements
2022-06-28 13:30:10 +02:00
Michael Matloka
29ef62f33d
refactor(plugin-server): Move vm.* tests over to ClickHouseLand (#9874)
* refactor(plugin-server): Move `vm.*` tests over to ClickHouseLand

* Don't expose injected dependencies of `KafkaProducerWrapper`

* Rework `KafkaProducerWrapper` and Celery `Client` mocking

* Add `rawSendMessage` to `KafkaProducerWrapper`

* Update kafka-health-check.test.ts

* Address feedback

* Address feedback more

* Don't clear mocks explicitly
2022-05-23 11:27:51 +02:00
Karl-Aksel Puulmann
b62a527f1b
fix: Make kafka health check not wait 5000ms (#9835)
* fix: Make kafka health check not wait 5000ms

When no messages to consume, by default the consumer waits 5000ms,
causing flakiness in tests and slowing other things down.

* Improve timeout test
2022-05-18 16:29:46 +03:00
Karl-Aksel Puulmann
146c697253
fix(plugin-server): Remove unused kafka reset test code (#9779)
This code doesn't seem to be doing anything useful. yeet!
2022-05-13 10:53:23 +00:00
Karl-Aksel Puulmann
2cc2584d56
refactor(plugin-server): Run ingestion only on worker threads (#9738)
* Refactor method to do everything it's supposed to do

No tests though?

* Remove unused argument from a function

* Remove dead code

* Run event pipeline on worker threads

* Remove code in way of refactor

* Make metrics happy

* Silence a yeetcode-related failure

* Mock over stopping unneeded services

* Yeetcode a test

* Reset the right table between tests

* Reset healthcheck consumer between tests

* Silence logspam around creating topics

* Significantly speed up resetting clickhouse tables between tests

This takes the function from 13-17s to 4s locally. Not great but not
terrible either.

* Remove try-catch

* Remove a dead test
2022-05-13 12:14:03 +03:00
James Greenhill
abc1de3972
Add teamId tag for plugin metrics (#8474)
* Add teamId tag for plugin metrics

* handle optional better

* Catch errors on topic creation if topic exists
2022-02-07 17:26:09 -08:00
Karl-Aksel Puulmann
78a787bc3b
Create and populate person_distinct_id2 table, add versioning to person_distinct_id (#7576)
* Migration to add version to person_distinct_id

* Update plugin-server type

* Use queueMessages instead of for loops

* Update distinct id versions in postgres

* Add commented out new query

* Add person_distinct_id2 table setup/migration

This will be used for more efficient person_distinct_id queries

* Avoid sharding person_distinct_id2 on cloud

* Write to new distinct ids topic

* Attempt to use version in tests

* Tests attempt 2

* Fixup version - dont send with all messages

* Flush kafka more frequently

* Actually fix tests

* Add another await

* Add partition to person_distinct_id2 table
2021-12-08 16:47:57 +02:00
James Greenhill
434e379f9a Add 'plugin-server/' from commit '01a99a4e26b0b11f068a7073d6b94e53a7214d33'
git-subtree-dir: plugin-server
git-subtree-mainline: 776b056b6d
git-subtree-split: 01a99a4e26
2021-10-28 14:59:19 -07:00
James Greenhill
145937a435
Revert "Monorepo with updated history" 2021-10-28 14:55:17 -07:00
James Greenhill
65512ae16f
Pack up plugin-server for moving 2021-10-12 15:45:42 -07:00