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

9451 Commits

Author SHA1 Message Date
Ben White
b4a401d532
feat: Billing V2 (#11986) 2022-10-19 08:58:36 +02:00
Karl-Aksel Puulmann
0ed667f088
chore(app-metrics): reset available_features cache when organization is updated (#12318) 2022-10-19 09:42:09 +03:00
Karl-Aksel Puulmann
37ee639cc4
fix(app-metrics): fix navigation issue (#12319)
https://github.com/PostHog/posthog/pull/12315 had a bug which broke
navigation. This fixes that
2022-10-19 00:35:19 +03:00
Tiina Turban
658667417a
fix: update insight api docs about refreshing flag (2) (#12322)
should be true, related https://posthoghelp.zendesk.com/agent/tickets/653
2022-10-18 20:12:42 +01:00
Paul D'Ambra
860da924d5
feat: highlight in legend for pie charts (#12249)
Problem
relates to #12226 and #11433

Changes
Highlights insight legend row when hovering over piechart
2022-10-18 20:09:58 +01:00
Ben White
85a178b2b9
feat: Added person properties expander to Meta area (#12294) 2022-10-18 15:07:45 -04: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
PostHog bot
1e05823af9
chore(deps): Update posthog-js to 1.33.0 (#12321) 2022-10-18 17:12:29 +01:00
Marius Andra
d4b7d29392
feat(apps): frontend urls (#12094)
* urls for apps

* add other types of plugin drawers to urls

* beforeunload

* fix double confirm
2022-10-18 17:12:47 +02: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
Neil Kakkar
a9e7537b7d
fix(experiments): Handle start and end dates appropriately (#12258) 2022-10-18 10:00:53 -04:00
Marius Andra
837ade677e
feat(apps): remove frontend apps feature flag (#12257) 2022-10-18 12:47:15 +00:00
Ben White
0119a0f59d
feat: Added app context to double check things (#12317) 2022-10-18 12:45:07 +00:00
Karl-Aksel Puulmann
20bc4cab01
fix: Revert "chore(api): meter rate limit on team" (#12316)
Revert "chore(api): meter rate limit on team (#12006)"

This reverts commit 258cd32f54.
2022-10-18 14:19:57 +03:00
Karl-Aksel Puulmann
c7e4cf9ca8
fix(app-metrics): Fix navigation issue (#12315)
Previously, the old appMetricsSceneLogic might not have been unmounted
by the time the navigation to a new one starts. This resulted in issues
where the old one would load data.
2022-10-18 11:02:14 +00:00
Ben White
015eae4f06
fix: Improvements to Organization model setup (#12309) 2022-10-18 12:46:11 +02:00
Paul D'Ambra
82c201a5f6
fix: dashboards last refresh not updating until page refresh (#12271)
When refreshing dashboard insights, the API call is against the Insight API.

This was returning the correct last_refresh date but that wasn't being copied into the dashboard tile, and so the dashboard didn't see the last refresh dates change until something in the UI (or a page refresh) reloaded tiles from the API.

Co-authored-by: Michael Matloka <dev@twixes.com>
2022-10-18 11:11:49 +01:00
Harry Waye
3e1ab7c2a5
test(plugin-server): fix exports test flakiness (#12313)
Occasionally the runEveryMinute gets called, which means our assumption
that exportEvents is the only call isn't true.
2022-10-18 09:11:29 +00:00
posthog-contributions-bot[bot]
755b7fc677
chore(contributors): 🤖 - Add rcmarron as a contributor 🎉 (#12310) 2022-10-18 09:21:40 +01:00
Rick Marron
258cd32f54
chore(api): meter rate limit on team (#12006)
## Problem

Take 2 on [this PR](https://github.com/PostHog/posthog/pull/11993#event-7470261128). The problem is that our rate limits should be based on `team_id` instead of an API key, and the last PR didn't handle views that didn't have a `team_id`.

## Changes

* Moves the rate_limit to be based on the `team_id` when possible
* Handles views that don't have a team_id
* Ensures the enabling/disabling of rate limits applies to all rate_limit classes (it used to only apply to the default classes)

and

* moves enabling the rate limit to an instance setting
* and adds a team id allow list for bypassing the rate limit
* and a simple cache which I think stops us hammering the reading of the infrequently changing settings

👉 *Stay up-to-date with [PostHog coding conventions](https://posthog.com/docs/contribute/coding-conventions) for a smoother review.*

## How did you test this code?

Added tests for the new cases:
* Rate limit works across a team - not just on an individual user.
* Rate limits work on views without a `team_id`
* Disabling the rate limits works


Co-authored-by: Paul D'Ambra <paul@posthog.com>
2022-10-18 09:01:07 +01:00
Karl-Aksel Puulmann
16096462f8
feat(app-metrics): Show exports progress (#12285)
* Consistently use correct key in historical exports

* feat(app-metrics): Show progress of export in exports page

* Fix lint
2022-10-18 10:35:23 +03:00
Paul D'Ambra
7a10b10603
fix: custom dashboard uses insight dates (#12305)
* fix: custom date_from_dashboard uses insights date_from

* more tests

* simplify the date_from and to choosing
2022-10-18 08:27:51 +01:00
Karl-Aksel Puulmann
4d1c0e45fb
feat(app-metrics): Gather and show information on errors (#12250)
* Add dependencies

* WIP: Gather error context

* Downgrade package

* Update tracking logic

* Query errors along with app metrics/export metrics

* last_seen

* Fetch and show errors table underneath metrics

* Sorting order

* Endpoint for fetching sample error details for an error

* Render error details drawer

* Render tabs in ErrorDetailsDrawer

* Tests for AppMetricsErrorsQuery

* Tests for AppMetricsErrorDetailsQuery

* Tests for historical_export_metrics

* Update existing app metrics API tests

* /error_details endpoint tests

* Update retries tests

* Update v2 historical exports tests

* Tests for app-metrics.ts

* run prettier

* Avoid reloading data on table sorting

* Fix fat-finger
2022-10-18 09:58:08 +03:00
Paul D'Ambra
27b53c7116
fix: more correct filtering of dashboard tiles (#12296)
The dashboard logic was incorrectly filtering out tiles when applying updated to turbo mode. Which sometimes caused text tiles to disappear until the dashboard was refreshed. Notably if anything caused the tiles to refresh
2022-10-17 20:08:34 +01:00
Tiina Turban
5f749aff4a
revert: "fix: increase CH wait time to reduce test flakiness" (#12301) 2022-10-17 21:08:16 +02:00
Paul D'Ambra
6acb332a36
chore: stricter typing on tile layouts (#12283)
## Problem

fly-by we tell typescript that `layouts` can be `Record<string, any>` but that's not true. 

## Changes

so let's tell typescript that `layouts` is `Record<DashboardLayoutSize, Layout>` 

## How did you test this code?

* loading dashboards and seeing them still work
* opening this PR and seeing if any TS errors shout at me
2022-10-17 20:07:55 +01:00
Michael Matloka
5c783c744c
chore: Add debug info to JSX output (#12295)
* chore: Add debug info to JSX output

* Pin React to `^16.14.0` instead of `^16.13.0`

* Remove redundant `React`s

* Add `@babel/preset-react` for Storybook

* Update babel.config.js
2022-10-17 19:30:31 +02:00
Ben White
9f0602a6d4
fix: Recording event loading (#12297)
Co-authored-by: Alex Kim <alexgkim205@gmail.com>
2022-10-17 16:42:51 +00:00
Yakko Majuri
7aaa6ef710
feat(0007-backfill): skip unnecessary dictionary lookups (#12221)
* feat(0007-backfill): skip unnecessary dictionary lookups

* Update posthog/async_migrations/migrations/0007_persons_and_groups_on_events_backfill.py

* Update snapshots

* fix

* add missing comma

* fix

* fix last test

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-17 13:02:55 -03:00
Ben White
909d390abd
fix: Removed transition anim for playback thumb (#12298) 2022-10-17 15:15:09 +00:00
Paul D'Ambra
2d0e03d99b
fix: allow custom as a date filter selection for dashboards (#12293)
Allows string | null as the dateFrom for a dashboard
2022-10-17 15:19:08 +01:00
zackelan
e645d88cb9
fix: rename TestKafkaProducer/Consumer to suppress pytest warning (#12270)
* fix: rename TestKafkaProducer/Consumer to suppress pytest warning

* Update snapshots

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2022-10-17 11:08:45 -03:00
Tiina Turban
a406f00aa0
fix: async migrations upgrade path from 1.37 to be sensible (#12292)
Fix: async migrations upgrade path from 1.37 to be sensible
2022-10-17 15:17:28 +02:00
Paul D'Ambra
ad7f55b5bd
fix(dashboards): loading 300 is slower than loading 1 (#12280)
## Problem

When loading a dashboard we use `dashboard` from the `dashboardsLogic` which seems reasonable except that is actually coming from the `dashboardsModel`. `dashboard` isn't available on the `dashboardsModel` until it has loaded 300 dashboards

## Changes

`allItems` on the `dashboardLogic` is the result of loading a single dashboard. Which is faster than loading 300 probably 🤷 

## How did you test this code?

running locally and seeing dashboards loading
2022-10-17 14:04:28 +01:00
Paul D'Ambra
5c72f2d51e
chore: remove some feature flags (#12219)
Removes an unused flag TOOLBAR_LAUNCH_SIDE_ACTION
removes a flag ALLOW_CSV_EXPORT_COLUMN_CHOICE that has been on for cloud users for 23 days
2022-10-17 14:03:35 +01:00
Tiina Turban
377f2ae47f
chore: Rollout groups properties writes to events (#12233)
* chore: Rollout groups properties writes to events

* forgotten save

* fix test
2022-10-17 09:50:20 -03:00
Michael Matloka
24d0c7eeff
fix(trends): Make formula and bold number combination more intuitive (#12291) 2022-10-17 12:32:55 +00:00
timgl
a99ca709db
fix(apps): Fix API token for apps (#12272)
* fix(apps): Fix API token for apps

* Fix hashing

* Use `this.db` directly instead of via `createCache()`

This way the personal API key will be unavailable to plugins.

* Limit key caching to 14 days

* Update plugins-api-key-manager.test.ts

Co-authored-by: Michael Matloka <dev@twixes.com>
2022-10-17 13:08:38 +01:00
Karl-Aksel Puulmann
9d915cc75a
fix(app-metrics): Fix distributed app_metrics table definition (#12287)
Queries in production were failing because of the following error:

```
DB::Exception: Conversion from AggregateFunction(sum, SimpleAggregateFunction(sum, Int64)) to AggregateFunction(sum, Int64) is not supported: while converting source column `sum(failures)` to destination column `sum(failures)`. (CANNOT_CONVERT_TYPE) (version 22.3.6.5 (official build))
```

The fix is to keep schema for sharded and distributed table in sync
2022-10-17 11:45:30 +00:00
Alex Gyujin Kim
69d2d55a84
chore(recordings): release console logs (#12266) 2022-10-17 13:09:50 +02:00
Emanuele Capparelli
0e295f19d6
feat: add activation checklist (#11966)
* feat: activation checklist

Co-authored-by: Michael Matloka <dev@twixes.com>
2022-10-17 12:57:14 +02:00
Ben White
b1d8ecca3c
fix: Events loading state and no-capture (#12282) 2022-10-17 10:45:07 +00:00
Paul D'Ambra
aabd22c8a4
fix: choose tags by clicking in list or by typing (#12279)
allows select to pass in the current value when actually selecting a tag so that you can choose pre-completed values
adds a spinner to the tag row to let user know when things are slow
2022-10-17 11:44:18 +01:00
Ben White
e38824c3aa
fix: Fix console warning on recordings (#12281) 2022-10-17 10:19:57 +00: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
Karl-Aksel Puulmann
cca4342876
chore(historical-exports): add statsd metrics for tracking (#12278)
chore(historical-exports): add statsd metrics for tracking errors/successes of historical exports
2022-10-17 12:45:42 +03:00
Alex Gyujin Kim
fb895b3a6a
fix(recordings): fix flashing error state on first load (#12263) 2022-10-17 08:53:15 +00:00
Paul D'Ambra
9b45f4bcc5
fix: better axis precision (#12262)
in this slack message a user reports that a graph with a series with all values less than 1 is hard to read because the axis ticks presented are 0 and 1.
2022-10-17 09:36:32 +01:00
Paul D'Ambra
0d57f0515c
chore: don't use filenames in uploaded media url (#12254)
* chore: url encode filenames used in uploaded media url

* correct use of quote

* Update snapshots

* chore: instrument-use-of-show-legend (#12253)

chore/instrument-use-of-show-legend

* chore: instrument unit choices (#12252)

* chore: ingestion warnings for alias calls preemptively (#12255)

* test(plugin-server): add pluginJob e2e tests (#12256)

* test(plugin-server): add pluginJob e2e tests

When trying to debug why some Graphile Worker jobs weren't going
through, I added some tests for export events v1, and runNow. This
didn't in the end help with my debugging, but should be useful as high
level tests for these features.

* chore: keep existing production seconds

* remove console.log

* feat: Recordings add support for moving forward and backward one frame (#12202)

* chore: allow overriding jest timezone (#12261)

* feat: show legend on dashboard for pie charts (#12248)

## Problem

related to #12226 #11433 

and closes #11863

## Changes

* updates dashboard view for pie charts to include the legend if shown
* adds aggregate value to the legend
* sorts the legend in descending order
* fixes hiding and showing pie segments and total when (un)selecting series in the legend

* remove file name from url

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tiina Turban <tiina303@gmail.com>
Co-authored-by: Harry Waye <harry@posthog.com>
Co-authored-by: Ben White <ben@benjackwhite.co.uk>
2022-10-17 09:46:08 +02:00
Alex Gyujin Kim
1f1e13ba75
feat(recordings): add console log intro and tracking (#12265) 2022-10-17 07:45:27 +00:00