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

139 Commits

Author SHA1 Message Date
Tomás Farías Santana
6c24b22a79
feat: BigQuery destination for BatchExports (#17170)
Co-authored-by: Tiina Turban <tiina303@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ben White <ben@posthog.com>
2023-09-07 18:22:22 +02:00
Tomás Farías Santana
17c5ec1710
feat: S3 BatchExports missing features (#17233) 2023-09-01 16:19:02 +02:00
Michael Matloka
fe909cf416
chore(deps): Update loginas from 0.3.9 to 0.3.11 (#16917) 2023-08-04 20:18:01 +02:00
Tomás Farías Santana
30d7144831
feat: Stream BatchExport queries in optimized format (#16583)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-25 11:48:48 +02:00
Michael Matloka
d53b9d6a62
feat(hogql): Ask question, get SQL from GPT (#16396)
* feat(hogql): Add GPT

* Allow tweaking query with AI

* Add feature flag

* Fix typo in `SerialiedField`

* Improve analytics

* Update query snapshots

* Update UI snapshots for `chromium` (2)

* Update query snapshots

* Gracefully handle lack of OpenAI key on hobby instances

* Update HogQLQueryEditor.tsx

* Add token usage analytics

* Use a banner for prompt unclear error

* Add max prompt length of 400

* Update test_preflight.py

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-07 14:26:28 +02:00
Paul D'Ambra
0e0e572b7a
chore: upgrade to Django 3.2.19 (#16193) 2023-06-22 13:45:40 +01:00
timgl
00ea8c36f2
feat(data-warehouse): Initial data warehouse setup (#16087)
* wip warehouse

* moar progress

* Update UI snapshots for `chromium` (2)

* fix types and bad logic

* make it work

* type

* update migration

* change icon

* Update UI snapshots for `chromium` (2)

* backend errors

* Update UI snapshots for `chromium` (2)

* fix tests

* remove duplicate regexp

* type

* ui

* more tests

* Update UI snapshots for `chromium` (1)

* client error

* Update query snapshots

* Update query snapshots

* Update UI snapshots for `chromium` (2)

* change api call and split out warehouse logic + restore data management tab

* Update query snapshots

* remove

* Update UI snapshots for `chromium` (1)

* Update query snapshots

* typing

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `webkit` (2)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `webkit` (2)

* dummy

* remove console log

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* encrypt

* fix migration

* fix

* tests

* add salt env var

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: eric <eeoneric@gmail.com>
2023-06-20 22:38:58 -04:00
Harry Waye
440642243a
chore(batch-exports): add snowflake export workflow (#15907)
* chore(batch-exports): add snowflake export workflow

This workflow uses Snowflake internal stages to load data from
ClickHouse into a Snowflake table. We maintain the existing events table
schema as used in the existing Snowflake App.

Something I haven't done yet is:

 1. made sure e.g. we get the `elements` and `person_set` etc. data into
    Snowflake.
 2. the additional frontend to enable configuring the Snowflake
    connection.

* remove unsed var

* include excluded events in test
2023-06-09 06:59:07 +00:00
Tomás Farías Santana
ebe7388c70
feat: Implement encryption codec for Temporal (#15566)
Co-authored-by: Harry Waye <harry@posthog.com>
2023-06-08 10:57:04 +01:00
Paul D'Ambra
596248c965
revert: chore: test chunking compression (#15865)
Revert "chore: test chunking compression (#15848)"

This reverts commit b7bc7908e2.
2023-06-02 11:56:38 +01:00
Paul D'Ambra
b7bc7908e2
chore: test chunking compression (#15848) 2023-06-02 10:17:34 +01:00
Harry Waye
ac1d3e7b52
feat(batch_exports): add backend API and S3 temporal workflow (#15649)
* feat(batch_exports): add backend API and S3 temporal workflow

This adds the backend API for batch exports, which will handle reverse
ETL exports to e.g. S3, Snowflake etc.

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-01 17:05:37 +01:00
Marius Andra
e23d4f562e
feat(hogql): window functions (#15132) 2023-05-31 12:53:31 +02:00
Paul D'Ambra
cffeea724f
revert: "chore: upgrade celery" (#15549) 2023-05-15 17:08:19 +00:00
Paul D'Ambra
4a7e3c293e
chore: upgrade celery (#15540) 2023-05-15 09:25:30 +01:00
Paul D'Ambra
5efd14441e
chore: upgrade drf (#15433) 2023-05-10 09:37:53 +01:00
Paul D'Ambra
f01add97b1
feat: update to drf exceptions hog 0.4.0 (#15424) 2023-05-08 18:49:04 +01:00
Michael Matloka
d71f58d599
chore(deps): Update drf-exceptions-hog to 0.3.1 (#15311) 2023-05-01 17:00:51 +00:00
Tomás Farías Santana
c641f0270b
fix: Update packaging dependency and pin prance (#15228)
https://twitter.com/pauldambra/status/1650845189848571904
2023-04-25 13:27:59 +00:00
Ben White
d9dfff1469
fix: webdriver missing dependency (#15222) 2023-04-25 08:46:16 +00:00
Paul D'Ambra
6440988c13
fix: updates some dependencies with "high" vulnerabiltiies (#15215)
* fix: update django to v3 latest

* upgrade redis-py too
2023-04-25 08:14:40 +01:00
dependabot[bot]
c24c2dfb07
chore(deps): bump sqlparse from 0.4.2 to 0.4.4 (#15192)
* chore(deps): bump sqlparse from 0.4.2 to 0.4.4

Bumps [sqlparse](https://github.com/andialbrecht/sqlparse) from 0.4.2 to 0.4.4.
- [Release notes](https://github.com/andialbrecht/sqlparse/releases)
- [Changelog](https://github.com/andialbrecht/sqlparse/blob/master/CHANGELOG)
- [Commits](https://github.com/andialbrecht/sqlparse/compare/0.4.2...0.4.4)

---
updated-dependencies:
- dependency-name: sqlparse
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update CI to work on forks

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michael Matloka <dev@twixes.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-24 13:32:51 +02:00
Neil Kakkar
b9ece59635
chore: bump posthoganalytics version, optimise decide (#15186) 2023-04-21 13:44:55 +01:00
Harry Waye
72c53ce55c
chore(capture): add OpenAPI spec for capture endpoints (#14962)
* Revert "Revert: docs(capture): add spec for capture endpoints (#14961)"

This reverts commit 063dc98056.

* fix tests
2023-04-03 17:14:51 +00:00
Harry Waye
063dc98056
Revert: docs(capture): add spec for capture endpoints (#14961)
Revert "docs(capture): add spec for capture endpoints (#14957)"

This reverts commit b5ef61c0c5.
2023-04-03 16:32:03 +00:00
Harry Waye
b5ef61c0c5
docs(capture): add spec for capture endpoints (#14957)
* docs(capture): add spec for capture endpoints

This adds an OpenAPI specification for the capture endpoints. This is
useful for documenting the API, and further can be used e.g. in tests to
validate that both clients and the API are behaving as expected.
2023-04-03 11:44:29 +00:00
dependabot[bot]
c2eaa168af
chore(deps): bump sentry-sdk from 1.11.1 to 1.14.0 (#14855)
Bumps [sentry-sdk](https://github.com/getsentry/sentry-python) from 1.11.1 to 1.14.0.
- [Release notes](https://github.com/getsentry/sentry-python/releases)
- [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-python/compare/1.11.1...1.14.0)

---
updated-dependencies:
- dependency-name: sentry-sdk
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-22 11:55:53 +01:00
James Greenhill
0223d7ab86
feat: Add Temporal to the dev and hobby stacks (#14658)
* feat: Add Temporal to the dev and hobby stacks

* disable elastic for hobby because of resources

* checkpoint

* update requirements

* worker is up, but without the sandbox

* ensure temporal does not depend on elastic

* Feedbacked

* pip-compile dev

* mypy fixes

* add a bit of colorful logging

* add django temporal worker to the mix

* checkpoint for dev-full docker

* Working on docker-full, but checkpointing for now

* add migration bits for full
2023-03-20 16:56:14 -06:00
timgl
2d835aacf6
fix(auth): Remove 2fa requirement if user is using 2fa (#14663)
* fix(auth): Remove 2fa requirement if user is using 2fa

* Remove last few social_2fa survivors

---------

Co-authored-by: James Greenhill <fuziontech@gmail.com>
2023-03-09 12:35:31 -08:00
Yakko Majuri
64ee8cf127
fix(deps): update deps following package rename (#14659) 2023-03-09 15:40:40 +00:00
Raquel Smith
864a9c1575
chore: update posthog python to latest (#14613)
update posthog python to latest
2023-03-08 08:51:55 -08:00
Raquel Smith
a7e362d70d
fix: update clickhouse-driver (#14405)
* update clickhouse-driver

* fix: pass empty context to escape_param

---------

Co-authored-by: Harry Waye <harry@posthog.com>
2023-03-06 10:10:06 +00:00
timgl
c3bc8d21ee
feat(Authentication): Support 2FA (#14284)
* feat(Authentication): Support 2FA

* Fix imports

* Fix requirements

* Add throttling and remembering cookie

* fix reqs

* Update snapshots

* fix quality issues

* Update snapshots

* fix tests

* Downgrade version b/c https://github.com/jazzband/django-two-factor-auth/issues/587

* make field nullable

* fix type issues

* fix issues

* fix tests

* small fixes & UX improvements

* Update snapshots

* forgot to commit

* fix

* fix tests

* fix snapshot

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Emanuele Capparelli <k@emkpp.com>
2023-02-21 19:10:44 +00:00
Paul D'Ambra
6c1141731e
fix: botocore unexpectedly started using a mocked file operation (#14126) 2023-02-07 21:30:20 +00:00
Marius Andra
6af31d41bc
feat(hogql): antlr grammar (#13971) 2023-02-07 17:02:29 +01:00
Tomás Farías Santana
09860d0f68
feat(capture): lift locality on distinct_id with spiking capture volume (#13934)
* feat: Automatically set hot partition keys in local cache

This allows us to override partition keys that have been locally
determined to be over a given threshold.

This commit is inteded as a test to motivate discussion. A final
solution should also consider handling the size of the local cache to
avoid memory overflows, specially for long running deployments.

* fix: Add type hint for counter

* refactor: Use token-bucket to decide to randomly partition

* revert: info window position changes (#13929)

* chore: Update comments

* chore: Add instrumentation to partition key override

* refactor: Rebase on master to bypass dynamic settings

* refactor: Move variables to settings and disable by default

* feat: Also rate limit the logging of override keys

* fix: Set capacity as float

* fix(capture): Make default setting a float

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

* fix(capture): Typo

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

* fix(capture): Format ingestion settings

* fix(capture): Use patched limiter for testing instead of reloading module

---------

Co-authored-by: Paul D'Ambra <paul@posthog.com>
Co-authored-by: Harry Waye <harry@posthog.com>
2023-02-06 15:35:21 +01:00
Marius Andra
67453e5a88
feat(data-exploration): data exploration backend API with types (#13933)
* feat(data-exploration): backend json schema validation

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* Update snapshots

* refactor

* switch to pydantic

* split into v2 events list query

* add backend query endpoint

* Update snapshots

* make events query work

* bring back HogQLExpression, inline all __root__ only classes in python, remove timestamp in old events query

* Update snapshots

* Update snapshots

* schema and mypy

* Update snapshots

* Update snapshots

* restore /fake/ orderBy (only "timestamp" and "-timestamp" are supported)

* Update snapshots

* Update snapshots

* Update snapshots

* raise if invalid json

* Update snapshots

* remove __root__ hack

* improve comments, in and out of quotes

* shrug

* future proofing

* comment

* rename to "run_events_query"

* simplify

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-01-27 15:30:28 +01:00
Michael Matloka
598baaf441
chore(deps): Remove obsolete django-rest-hooks requirement (#13349)
* chore(deps): Remove obsolete `django-rest-hooks` requirement

* Update snapshots

* Fix type annotations

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-12-19 10:06:21 +01:00
Marius Andra
94d0017a4d
feat(data-exploration): formulas in tables, custom columns, aggregations (#13203)
Hi Neil :)
2022-12-16 15:11:03 +00:00
Paul D'Ambra
6bbcdfdc3a
chore: upgrade requests (#13020)
so that we upgrade urllib3 which sentry latest needs

Problem
running pip install -r ./requirements.txt worked fine

but running pip install -r ./requirements.txt && pip install -r ./requirements-dev.txt gave an error message

Installing collected packages: urllib3
  Attempting uninstall: urllib3
    Found existing installation: urllib3 1.26.13
    Uninstalling urllib3-1.26.13:
      Successfully uninstalled urllib3-1.26.13
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sentry-sdk 1.11.1 requires urllib3>=1.26.11; python_version >= "3.6", but you have urllib3 1.26.5 which is incompatible.
Changes
Upgraded the requests library and regenerated the requirements files
2022-11-30 16:50:23 +00:00
Paul D'Ambra
233e697d18
feat: enable sentry python profiling (#12980) 2022-11-29 09:07:17 +00:00
Michael Matloka
c4b2fec3b6
chore: Include event_error_id in 500 error responses (#12895) 2022-11-23 00:54:05 +01:00
timgl
59da0e7a1a
fix(cohorts): Fix exports with a lot of distinct ids (#12825)
* fix(cohorts): Fix exports with a lot of distinct ids

* fix tests

* fix tests
2022-11-17 14:19:36 +00:00
Guido Iaquinti
db7d49feef
fix(django): upgrade from 3.2.15 to 3.2.16 (#12402) 2022-10-24 15:11:58 +02:00
Marius Andra
72df443c49
chore(pip): upgrade social-auth-core (#12386) 2022-10-24 10:13:50 +02:00
Paul D'Ambra
2f4e7736a7
chore: upgrade webdriver manager (#12325) 2022-10-21 09:14:04 +02:00
Karl-Aksel Puulmann
b33347205c
fix: Revert "chore(tests): add pytest-randomly plugin to randomize test run order" (#12335)
* Revert "chore(tests): add pytest-randomly plugin to randomize test run order (#12307)"

This reverts commit 313de83cb8.

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-19 13:30:16 +03:00
zackelan
313de83cb8
chore(tests): add pytest-randomly plugin to randomize test run order (#12307)
* chore(tests): add pytest-randomly plugin to randomize test run order

* Update snapshots

* Update snapshots

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-18 09:34:34 -07:00
Paul D'Ambra
794de6864a
fix: verify image files on upload (#12267)
## Problem

Django validates file content type by reading "magic bytes" from the start of the file. It doesn't then check that file really is the type it claims to be. https://docs.djangoproject.com/en/4.1/topics/security/#user-uploaded-content

That's not good enough for rock and roll. And would allow an attacker to attempt to upload HTML with magic bytes that pretend to be an image file. We would store that and then serve it back to a dashboard. ☠️  See more at https://trailofbits.github.io/ctf/forensics/

## Changes

On upload use the [Pillow image library](https://github.com/python-pillow/Pillow) to open the file and transpose it. The image must be valid to be successfully transposed.

## How did you test this code?

* Adding a valid image file and seeing the developer tests still run
* Adding a file handcrafted to start with gif magic bytes but not actually be a gif and seeing validation fail
* Uploading an image to a dashboard and seeing it still work
2022-10-17 11:13:05 +01:00
Guido Iaquinti
8145b682bf
chore(numpy): upgrade from 1.21.4 to 1.23.3 (#12142) 2022-10-07 14:14:39 +02:00