Skip to content

Commit

Permalink
Merge branch 'master' into ch-24.3
Browse files Browse the repository at this point in the history
* master: (100 commits)
  revert: perf: Speed up filtering persons (#25715)
  chore: count data ingested by source (#25714)
  fix(bi): Dont try to be too clever with variables (#25712)
  fix(cdp): Ask for kinesis stream name, not the ARN (#25711)
  fix(batch-exports): Deal with deeply nested events (#25710)
  fix(batch-exports): Ingest as JSON in Redshift super type (#25709)
  perf: Speed up filtering persons (#25604)
  feat(data-warehouse): Add button to cancel batch export backfill run (#25706)
  feat(cdp): add discord template (#25649)
  feat(max): Show query summary (#25696)
  feat(errors): Use exception list and remove stack trace raw (#25655)
  fix: smaller cohort resource usage for replay filters (#25699)
  chore: use meta columns in data visualization table (#25697)
  feat(cdp): add klaviyo templates (#25693)
  feat(max): Answer feedback buttons (#25670)
  feat(cdp): add google ads integration warning (#25698)
  feat(hog): print ast in console (#25608)
  feat(data-warehouse): edit SQL based import configs (#25685)
  fix(insights): handle negation property in cohort property filters (#25691)
  fix: warming and filter (#25674)
  ...
  • Loading branch information
fuziontech committed Oct 21, 2024
2 parents 45964f2 + 6b91cb8 commit d7332d7
Show file tree
Hide file tree
Showing 587 changed files with 15,421 additions and 4,400 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/container-images-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ jobs:
uses: aws-actions/amazon-ecr-login@v2

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: posthog
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push container image
Expand Down
31 changes: 15 additions & 16 deletions .github/workflows/copy-clickhouse-udfs.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
name: Trigger UDFs Workflow

on:
push:
branches:
- master
paths:
- 'posthog/user_scripts/**'
push:
branches:
- master
paths:
- 'posthog/user_scripts/**'

jobs:
trigger_udfs_workflow:
runs-on: ubuntu-latest
steps:
- name: Trigger UDFs Workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: .github/workflows/clickhouse-udfs.yml
repo: posthog/posthog-cloud-infra
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
ref: refs/heads/main

trigger_udfs_workflow:
runs-on: ubuntu-latest
steps:
- name: Trigger UDFs Workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: .github/workflows/clickhouse-udfs.yml
repo: posthog/posthog-cloud-infra
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
ref: refs/heads/main
2 changes: 1 addition & 1 deletion .github/workflows/pr-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: posthog
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- uses: aws-actions/configure-aws-credentials@v4
Expand Down
2 changes: 2 additions & 0 deletions .storybook/decorators/withKea/kea-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { worker } from '~/mocks/browser'
import { teamLogic } from 'scenes/teamLogic'
import { userLogic } from 'scenes/userLogic'
import { projectLogic } from 'scenes/projectLogic'

export function resetKeaStory(): void {
worker.resetHandlers()
Expand All @@ -18,6 +19,7 @@ export function resetKeaStory(): void {
initKea({ routerLocation: history.location, routerHistory: history })
featureFlagLogic.mount()
teamLogic.mount()
projectLogic.mount()
userLogic.mount()
router.mount()
const { store } = getContext()
Expand Down
1 change: 1 addition & 0 deletions bin/copy-posthog-js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ set -e

cp node_modules/posthog-js/dist/array.js* frontend/dist/
cp node_modules/posthog-js/dist/array.full.js* frontend/dist/
cp node_modules/posthog-js/dist/array.full.es5.js* frontend/dist/
cp node_modules/posthog-js/dist/recorder.js* frontend/dist/
cp node_modules/posthog-js/dist/recorder-v2.js* frontend/dist/
cp node_modules/posthog-js/dist/surveys.js* frontend/dist/
Expand Down
37 changes: 34 additions & 3 deletions cypress/e2e/alerts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@ describe('Alerts', () => {
const createAlert = (
name: string = 'Alert name',
lowerThreshold: string = '100',
upperThreshold: string = '200'
upperThreshold: string = '200',
condition?: string
): void => {
cy.get('[data-attr=more-button]').click()
cy.contains('Manage alerts').click()
cy.contains('New alert').click()

cy.get('[data-attr=alertForm-name]').clear().type(name)
cy.get('[data-attr=subscribed-users').click().type('{downarrow}{enter}')

if (condition) {
cy.get('[data-attr=alertForm-condition').click()
cy.contains(condition).click()
cy.contains('%').click()
}

cy.get('[data-attr=alertForm-lower-threshold').clear().type(lowerThreshold)
cy.get('[data-attr=alertForm-upper-threshold').clear().type(upperThreshold)
cy.contains('Create alert').click()
Expand All @@ -39,7 +47,6 @@ describe('Alerts', () => {
cy.get('[data-attr=insight-edit-button]').click()
cy.get('[data-attr=chart-filter]').click()
cy.contains(displayType).click()
cy.get('.insight-empty-state').should('not.exist')
cy.get('[data-attr=insight-save-button]').contains('Save').click()
cy.url().should('not.include', '/edit')
}
Expand Down Expand Up @@ -69,7 +76,7 @@ describe('Alerts', () => {
})

it('Should warn about an alert deletion', () => {
setInsightDisplayTypeAndSave('Number')
setInsightDisplayTypeAndSave('Area chart')

createAlert('Alert to be deleted because of a changed insight')

Expand All @@ -90,4 +97,28 @@ describe('Alerts', () => {
cy.contains('Manage alerts').click()
cy.contains('Alert to be deleted because of a changed insight').should('not.exist')
})

it('Should allow create and delete a relative alert', () => {
cy.get('[data-attr=more-button]').click()
// Alerts should be disabled for trends represented with graphs
cy.get('[data-attr=manage-alerts-button]').should('have.attr', 'aria-disabled', 'true')

setInsightDisplayTypeAndSave('Bar chart')

createAlert('Alert name', '10', '20', 'increases by')
cy.reload()

// Check the alert has the same values as when it was created
cy.get('[data-attr=more-button]').click()
cy.contains('Manage alerts').click()
cy.get('[data-attr=alert-list-item]').contains('Alert name').click()
cy.get('[data-attr=alertForm-name]').should('have.value', 'Alert name')
cy.get('[data-attr=alertForm-lower-threshold').should('have.value', '10')
cy.get('[data-attr=alertForm-upper-threshold').should('have.value', '20')
cy.contains('Delete alert').click()
cy.wait(2000)

cy.reload()
cy.contains('Alert name').should('not.exist')
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/billingUpgradeCTA.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ describe('Billing Upgrade CTA', () => {
cy.reload()

cy.get('[data-attr=billing-page-core-upgrade-cta] .LemonButton__content').should('not.exist')
cy.get('[data-attr=manage-billing]').should('have.text', 'Manage card details and view past invoices')
cy.get('[data-attr=manage-billing]').should('have.text', 'Manage card details and invoices')
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/dashboard-duplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('duplicating dashboards', () => {
let dashboardName, insightName, expectedCopiedDashboardName, expectedCopiedInsightName

beforeEach(() => {
cy.intercept('POST', /\/api\/projects\/\d+\/dashboards/).as('createDashboard')
cy.intercept('POST', /\/api\/environments\/\d+\/dashboards/).as('createDashboard')

dashboardName = randomString('dashboard-')
expectedCopiedDashboardName = `${dashboardName} (Copy)`
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/dashboard-shared.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { dashboards } from '../productAnalytics'

describe('Shared dashboard', () => {
beforeEach(() => {
cy.intercept('GET', /api\/projects\/\d+\/insights\/\?.*/).as('loadInsightList')
cy.intercept('PATCH', /api\/projects\/\d+\/insights\/\d+\/.*/).as('patchInsight')
cy.intercept('POST', /\/api\/projects\/\d+\/dashboards/).as('createDashboard')
cy.intercept('GET', /api\/environments\/\d+\/insights\/\?.*/).as('loadInsightList')
cy.intercept('PATCH', /api\/environments\/\d+\/insights\/\d+\/.*/).as('patchInsight')
cy.intercept('POST', /\/api\/environments\/\d+\/dashboards/).as('createDashboard')
cy.useSubscriptionStatus('unsubscribed')

cy.clickNavMenu('dashboards')
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/dashboard.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { randomString } from '../support/random'

describe('Dashboard', () => {
beforeEach(() => {
cy.intercept('GET', /api\/projects\/\d+\/insights\/\?.*/).as('loadInsightList')
cy.intercept('PATCH', /api\/projects\/\d+\/insights\/\d+\/.*/).as('patchInsight')
cy.intercept('POST', /\/api\/projects\/\d+\/dashboards/).as('createDashboard')
cy.intercept('GET', /api\/environments\/\d+\/insights\/\?.*/).as('loadInsightList')
cy.intercept('PATCH', /api\/environments\/\d+\/insights\/\d+\/.*/).as('patchInsight')
cy.intercept('POST', /\/api\/environments\/\d+\/dashboards/).as('createDashboard')

cy.clickNavMenu('dashboards')
cy.location('pathname').should('include', '/dashboard')
Expand Down Expand Up @@ -306,7 +306,7 @@ describe('Dashboard', () => {
})

it('Move dashboard item', () => {
cy.intercept('PATCH', /api\/projects\/\d+\/dashboards\/\d+\/move_tile.*/).as('moveTile')
cy.intercept('PATCH', /api\/environments\/\d+\/dashboards\/\d+\/move_tile.*/).as('moveTile')

const sourceDashboard = randomString('source-dashboard')
const targetDashboard = randomString('target-dashboard')
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/insights-saved.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Insights - saved', () => {
})

it('If cache empty, initiate async refresh', () => {
cy.intercept('GET', /\/api\/projects\/\d+\/insights\/?\?[^/]*?refresh=async/).as('getInsightsRefreshAsync')
cy.intercept('GET', /\/api\/environments\/\d+\/insights\/?\?[^/]*?refresh=async/).as('getInsightsRefreshAsync')
let newInsightId: string
createInsight('saved insight').then((insightId) => {
newInsightId = insightId
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/insights.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Insights', () => {
})

it('Create new insight and save and continue editing', () => {
cy.intercept('PATCH', /\/api\/projects\/\d+\/insights\/\d+\/?/).as('patchInsight')
cy.intercept('PATCH', /\/api\/environments\/\d+\/insights\/\d+\/?/).as('patchInsight')

const insightName = randomString('insight-name-')
createInsight(insightName)
Expand Down
18 changes: 18 additions & 0 deletions cypress/e2e/notebooks-insights.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { insight, savedInsights } from '../productAnalytics'

describe('Notebooks', () => {
beforeEach(() => {
cy.clickNavMenu('notebooks')
cy.location('pathname').should('include', '/notebooks')
})
;['SQL', 'TRENDS', 'FUNNELS', 'RETENTION', 'PATHS', 'STICKINESS', 'LIFECYCLE'].forEach((insightType) => {
it(`Can add a ${insightType} insight`, () => {
savedInsights.createNewInsightOfType(insightType)
insight.editName(`${insightType} Insight`)
insight.save()
cy.get('[data-attr="notebooks-add-button"]').click()
cy.get('[data-attr="notebooks-select-button-create"]').click()
cy.get('.ErrorBoundary').should('not.exist')
})
})
})
4 changes: 2 additions & 2 deletions cypress/e2e/notebooks.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { urls } from 'scenes/urls'
describe('Notebooks', () => {
beforeEach(() => {
cy.fixture('api/session-recordings/recordings.json').then((recordings) => {
cy.intercept('GET', /api\/projects\/\d+\/session_recordings\/?\?.*/, { body: recordings }).as(
cy.intercept('GET', /api\/environments\/\d+\/session_recordings\/?\?.*/, { body: recordings }).as(
'loadSessionRecordingsList'
)
})

cy.fixture('api/session-recordings/recording.json').then((recording) => {
cy.intercept('GET', /api\/projects\/\d+\/session_recordings\/.*\?.*/, { body: recording }).as(
cy.intercept('GET', /api\/environments\/\d+\/session_recordings\/.*\?.*/, { body: recording }).as(
'loadSessionRecording'
)
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/projectHomepage.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Project Homepage', () => {
beforeEach(() => {
cy.intercept('GET', /\/api\/projects\/\d+\/dashboards\/\d+\//).as('getDashboard')
cy.intercept('GET', /\/api\/environments\/\d+\/dashboards\/\d+\//).as('getDashboard')
cy.clickNavMenu('projecthomepage')
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/trends.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Trends', () => {
})

it('Can load a graph from a URL directly', () => {
cy.intercept('POST', /api\/projects\/\d+\/query\//).as('loadNewQueryInsight')
cy.intercept('POST', /api\/environments\/\d+\/query\//).as('loadNewQueryInsight')

// regression test, the graph wouldn't load when going directly to a URL
cy.visit(
Expand Down
8 changes: 4 additions & 4 deletions cypress/productAnalytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const insight = {
cy.url().should('not.include', '/new')
},
clickTab: (tabName: string): void => {
cy.intercept('POST', /api\/projects\/\d+\/query\//).as('loadNewQueryInsight')
cy.intercept('POST', /api\/environments\/\d+\/query\//).as('loadNewQueryInsight')

cy.get(`[data-attr="insight-${(tabName === 'PATHS' ? 'PATH' : tabName).toLowerCase()}-tab"]`).click()
if (tabName !== 'FUNNELS') {
Expand All @@ -51,7 +51,7 @@ export const insight = {
}
},
newInsight: (insightType: string = 'TRENDS'): void => {
cy.intercept('POST', /api\/projects\/\d+\/query\//).as('loadNewQueryInsight')
cy.intercept('POST', /api\/environments\/\d+\/query\//).as('loadNewQueryInsight')

if (insightType === 'JSON') {
cy.clickNavMenu('savedinsights')
Expand Down Expand Up @@ -86,7 +86,7 @@ export const insight = {
cy.url().should('not.include', '/new') // wait for insight to complete and update URL
},
addInsightToDashboard: (dashboardName: string, options: { visitAfterAdding: boolean }): void => {
cy.intercept('PATCH', /api\/projects\/\d+\/insights\/\d+\/.*/).as('patchInsight')
cy.intercept('PATCH', /api\/environments\/\d+\/insights\/\d+\/.*/).as('patchInsight')

cy.get('[data-attr="save-to-dashboard-button"]').click()
cy.get('[data-attr="dashboard-searchfield"]').type(dashboardName)
Expand Down Expand Up @@ -158,7 +158,7 @@ export const dashboards = {

export const dashboard = {
addInsightToEmptyDashboard: (insightName: string): void => {
cy.intercept('POST', /api\/projects\/\d+\/insights\//).as('postInsight')
cy.intercept('POST', /api\/environments\/\d+\/insights\//).as('postInsight')

cy.get('[data-attr=dashboard-add-graph-header]').contains('Add insight').click()
cy.get('[data-attr=toast-close-button]').click({ multiple: true })
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ beforeEach(() => {
req.reply({ statusCode: 404, body: 'Cypress forced 404' })
)

cy.intercept('GET', /\/api\/projects\/\d+\/insights\/?\?/).as('getInsights')
cy.intercept('GET', /\/api\/environments\/\d+\/insights\/?\?/).as('getInsights')

cy.request('POST', '/api/login/', {
email: '[email protected]',
Expand Down
14 changes: 7 additions & 7 deletions docker/clickhouse/user_defined_function.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<function>
<type>executable_pool</type>
<name>aggregate_funnel_trends</name>
<return_type>Array(Tuple(UInt64, Int8, Nullable(String)))</return_type>
<return_type>Array(Tuple(UInt64, Int8, Nullable(String), UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
Expand Down Expand Up @@ -169,7 +169,7 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, Nullable(String), Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
Expand All @@ -181,7 +181,7 @@
<type>executable_pool</type>
<name>aggregate_funnel_array_trends</name>
<!-- Return type for trends is a start interval time, a success flag (1 or -1), and a breakdown value -->
<return_type>Array(Tuple(UInt64, Int8, Array(String)))</return_type>
<return_type>Array(Tuple(UInt64, Int8, Array(String), UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
Expand All @@ -208,7 +208,7 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, Array(String), Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
Expand All @@ -220,7 +220,7 @@
<type>executable_pool</type>
<name>aggregate_funnel_cohort_trends</name>
<!-- Return type for trends is a start interval time, a success flag (1 or -1), and a breakdown value -->
<return_type>Array(Tuple(UInt64, Int8, UInt64))</return_type>
<return_type>Array(Tuple(UInt64, Int8, UInt64, UUID))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
Expand All @@ -247,7 +247,7 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, UInt64, Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, UInt64, Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
Expand Down Expand Up @@ -285,7 +285,7 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, Array(String), Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UInt64, UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
Expand Down
Loading

0 comments on commit d7332d7

Please sign in to comment.