Commit Graph

21 Commits

Author SHA1 Message Date
Ben White
81117d1d61 feat: Added simd json parsing option (#30005) 2025-03-17 09:59:17 +00:00
Ben White
dc77ad8b01 chore(cdp): Removed job and schedules (#29352) 2025-03-03 13:31:54 +01:00
Oliver Browne
7207da93e9 feat: Inline plugins (plugins without running VM2) (#23443)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ben White <ben@posthog.com>
2024-07-24 14:49:31 +03:00
ted kaemming
9299aa09e5 fix(plugin-server): Remove Postgres-based plugin error logging in favor of existing ClickHouse-based approaches (#18764) 2023-11-27 10:41:36 -08:00
ted kaemming
f342f35f33 test(plugin-server): Reduce flakiness of plugin teardown functional tests (#18896) 2023-11-27 07:51:39 -08:00
Tiina Turban
e3298f897f feat: p-s to support composeWebhook (#18465) 2023-11-09 18:19:18 +01:00
Xavier Vello
68fd523c35 fix(ci): fix flaky 'plugins can use attachements' test (#18341) 2023-11-02 15:40:33 +01:00
Brett Hoerner
d16408784f fix(plugin-server): fix unicode null byte blowing up the pipeline (#18282) 2023-10-30 16:39:10 -06:00
Xavier Vello
1b6628055d feat(plugin-server): allow to use several PG connection pools (#17001)
Co-authored-by: Tiina Turban <tiina303@gmail.com>
2023-08-24 11:09:10 +02:00
Harry Waye
9f0cf9f40f chore: make attachement test less flakey
We do this by making sure the plugin config and the attachement are
committed together.
2023-07-11 14:08:29 +00:00
Harry Waye
aa488321e6 chore: allow plugins to be made non-global but continue to work (#15860)
We want to be able to make plugins non-global, but we don't want to
break existing plugins. This commit adds a test to ensure that plugins
continue to work when they are made non-global.

Previously they would have been disabled by the `is_global` check.

TODO: what will be the impact of making this change.
2023-06-02 10:42:06 +01:00
Harry Waye
d8773d99d9 test: add tests for plugin secrets (#15754)
* test(plugin-server): add test for attachments

We didn't have one before, now we do!

* test: add tests for plugin secrets

Adds basic test for using configurations in plugins. This is a first
step towards getting lazy loading of plugins in safely:
https://github.com/PostHog/posthog/pull/15704
2023-05-26 18:00:45 +00:00
Harry Waye
685d1e2fc8 test(plugin-server): add test for attachments (#15752)
We didn't have one before, now we do!
2023-05-26 17:17:14 +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
0b64b3a79f chore(async-liveness): add async liveness check (#14811)
To make sure pods are restarted if they get stuck.
2023-03-17 18:12:56 +00:00
Harry Waye
01da91d1e2 test: remove explicit dependencies from functional tests (#14471)
* test: remove explicit dependencies from functional tests

* Install pnpm in devcontainer
2023-03-01 12:03:54 +00:00
Harry Waye
a4a3a0c902 test(plugin-server): use librdkafka for functional tests (#14468)
* test(plugin-server): use librdkafka for functional tests

While trying to port the session recordings to use node-librdkafka I
found it useful to first implement it in the functional tests.

* use obj destructuring to make calls more self explanatory
2023-03-01 11:03:13 +00:00
Harry Waye
51e134e98c chore(session-recordings): separate topics for events as recordings (#13654)
* chore(session-recordings): separate topics for events as recordings

WIP

* fix tests

* Use simpler consumer for session recordings

* wip

* still batch things by batchSize

* add tests, improve comments

* rename topic var

* push performance_events to session recordings topic also

* Add completely separate consumer for session-recordings

* wip

* use session_id for partition key

* fix test

* handle team_id/token null

* wip

* fix tests

* wip

* use kafka_topic var in logs

* use logger

* fix test

* Fix $performance_event topic usage

* fix tests

* fix check for null/undefined

* Update posthog/api/capture.py

Co-authored-by: Tomás Farías Santana <tomas@tomasfarias.dev>

* Add test for kafka error handling

* Remove falsy teamId check

* fix statsd error

* kick ci

* Use existing getTeamByToken

* remove partition key from recordings

* Make sure producer is connected !

* fix session id kafka key test

* add back throws!

* set producer on each test

* skip flaky test

* add flush error logs

* wait for persons to be ingested

* fix skip

Co-authored-by: Tomás Farías Santana <tomas@tomasfarias.dev>
2023-01-17 12:04:03 +00:00
Harry Waye
a27d452171 feat(person-on-events): add option to delay all events (#13505)
* feat(person-on-events): add option to delay all events

This change implements the option outlined in
https://github.com/PostHog/product-internal/pull/405

Here I do not try to do any large structural changes to the code, I'll
leave that for later although it does mean the code has a few loose
couplings between pipeline steps that probably should be strongly
coupled. I've tried to comment these to try to make it clear about the
couplings.

I've also added a workflow to run the functional tests against both
configurations, which we can remove once we're happy with the new
implementation.

Things of note:

 1. We can't enable this for all users yet, not without the live events
    view and not without verifying that the buffer size is sufficiently
    large. We can however enable this for the test team and verify that
    it functions as expected.
 2. I have not handled the case mentioned in the above PR regarding
    guarding against processing the delayed events before all events in
    the delay window have been processed.

wip

test(person-on-events): add currently failing test for person on events

This test doesn't work with the previous behaviour of the
person-on-events implementation, but should pass with the new delay all
events behaviour.

* add test for KafkaJSError behaviour

* add comment re delay

* add test for create_alias

* chore: increase exports timeout

It seems to fail in CI, but only for the delayed events enabled tests.
I'm not sure why, but I'm guessing it's because the events are further
delayed by the new implementation.

* chore: fix test

* add test for ordering of person properties

* use ubuntu-latest-8-cores runner

* add tests for plugin processEvent

* chore: ensure plugin processEvent isn't run multiple times

* expand on person properties ordering test

* wip

* wip

* add additional test

* change fullyProcessEvent to onlyUpdatePersonIdAssociations

* update test

* add test to ensure person properties do not propagate backwards in time

* simplicfy person property tests

* weaken guarantee in test

* chore: make sure we don't update properties on the first parse

We should only be updating person_id and asociated distinct_ids on first
parse.

* add tests for dropping events

* increase export timeout

* increase historical exports timeout

* increase default waitForExpect interval to 1 second
2023-01-05 16:38:43 +00:00
Harry Waye
63ba5e2fb7 chore: remove usage of delayUntilEventsIngested (#13509)
Its usage is odd and it's not clear what it's doing.
2022-12-29 21:54:44 +00:00
Harry Waye
0869801a8e chore(plugin-server): split functional tests into feature based files (#13031)
* chore(plugin-server): split functional tests into feature based files

This is intended to make it more obvious what we are testing, and to try
and identify the major themes of the plugin-server functionality.

As a by product it should make things more parallelizable for jest as
the tests in different files will be isolated, runnable in separate
workers.

* use random api token, avoid db constraints

* make tests silent

* format

* chore: set number of jest workers

These tests should be pretty light given they just hit other APIs and
don't do much themselves. Memory could be an issue on constrained
environments. We shall see.
2022-11-30 12:49:17 +00:00