Skip to content

Commit

Permalink
Merge branch 'master' into zach/wildcard-port
Browse files Browse the repository at this point in the history
  • Loading branch information
zlwaterfield authored Oct 7, 2024
2 parents ba5d807 + 129b279 commit a4cc671
Show file tree
Hide file tree
Showing 831 changed files with 39,116 additions and 13,115 deletions.
2 changes: 1 addition & 1 deletion .github/actions/run-backend-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ runs:

- name: Upload updated timing data as artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.person-on-events != 'true' && inputs.clickhouse-server-image == 'clickhouse/clickhouse-server:23.12.6.19-alpine' }}
if: ${{ inputs.person-on-events != 'true' && inputs.clickhouse-server-image == 'clickhouse/clickhouse-server:23.12.6.19' }}
with:
name: timing_data-${{ inputs.segment }}-${{ inputs.group }}
path: .test_durations
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-backend-update-test-timing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
group: 1
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
python-version: '3.11.9'
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19-alpine'
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
segment: 'FOSS'
person-on-events: false

- name: Upload updated timing data as artifacts
uses: actions/upload-artifact@v4
if: ${{ inputs.person-on-events != 'true' && inputs.clickhouse-server-image == 'clickhouse/clickhouse-server:23.12.6.19-alpine' }}
if: ${{ inputs.person-on-events != 'true' && inputs.clickhouse-server-image == 'clickhouse/clickhouse-server:23.12.6.19' }}
with:
name: timing_data-${{ inputs.segment }}-${{ inputs.group }}
path: .test_durations
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/ci-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ jobs:
run: |
npm run schema:build:python && git diff --exit-code
- uses: actions/checkout@v4
with:
repository: 'PostHog/posthog-cloud-infra'
path: 'posthog-cloud-infra'
token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}

check-migrations:
needs: changes
if: needs.changes.outputs.backend == 'true'
Expand Down Expand Up @@ -240,7 +234,7 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.11.9']
clickhouse-server-image: ['clickhouse/clickhouse-server:23.12.6.19-alpine']
clickhouse-server-image: ['clickhouse/clickhouse-server:23.12.6.19']
segment: ['Core']
person-on-events: [false, true]
# :NOTE: Keep concurrency and groups in sync
Expand All @@ -249,7 +243,7 @@ jobs:
include:
- segment: 'Temporal'
person-on-events: false
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19-alpine'
clickhouse-server-image: 'clickhouse/clickhouse-server:23.12.6.19'
python-version: '3.11.9'
concurrency: 1
group: 1
Expand Down Expand Up @@ -320,7 +314,7 @@ jobs:
strategy:
fail-fast: false
matrix:
clickhouse-server-image: ['clickhouse/clickhouse-server:23.12.6.19-alpine']
clickhouse-server-image: ['clickhouse/clickhouse-server:23.12.6.19']
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rust-docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
dockerfile: ./rust/Dockerfile
- image: property-defs-rs
dockerfile: ./rust/Dockerfile
- image: error-tracking
- image: cymbal
dockerfile: ./rust/Dockerfile
runs-on: depot-ubuntu-22.04-4
permissions:
Expand All @@ -48,7 +48,7 @@ jobs:
hook-janitor_digest: ${{ steps.digest.outputs.hook-janitor_digest }}
hook-worker_digest: ${{ steps.digest.outputs.hook-worker_digest }}
hook-migrator_digest: ${{ steps.digest.outputs.hook-migrator_digest }}
error-tracking-rs_digest: ${{ steps.digest.outputs.error-tracking-rs_digest }}
cymbal_digest: ${{ steps.digest.outputs.cymbal_digest }}

defaults:
run:
Expand Down Expand Up @@ -144,10 +144,10 @@ jobs:
values:
image:
sha: '${{ needs.build.outputs.property-defs-rs_digest }}'
# - release: error-tracking-rs - disabled until a charts in place, for now we just build
# - release: cymbal - disabled until a charts in place, for now we just build
# values:
# image:
# sha: '${{ needs.build.outputs.error-tracking-rs_digest }}'
# sha: '${{ needs.build.outputs.cymbal_digest }}'
- release: hoghooks
values:
api_image:
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ RUN pnpm build
FROM ghcr.io/posthog/rust-node-container:bullseye_rust_1.80.1-node_18.19.1 AS plugin-server-build
WORKDIR /code
COPY ./rust ./rust
COPY ./plugin-transpiler/ ./plugin-transpiler/
WORKDIR /code/plugin-server
SHELL ["/bin/bash", "-e", "-o", "pipefail", "-c"]

Expand All @@ -63,6 +64,9 @@ RUN apt-get update && \
corepack enable && \
mkdir /tmp/pnpm-store && \
pnpm install --frozen-lockfile --store-dir /tmp/pnpm-store && \
cd ../plugin-transpiler && \
pnpm install --frozen-lockfile --store-dir /tmp/pnpm-store && \
pnpm build && \
rm -rf /tmp/pnpm-store

# Build the plugin server.
Expand Down Expand Up @@ -186,11 +190,11 @@ ARG COMMIT_HASH
RUN echo $COMMIT_HASH > /code/commit.txt

# Add in the compiled plugin-server & its runtime dependencies from the plugin-server-build stage.
COPY --from=plugin-server-build --chown=posthog:posthog /code/plugin-transpiler/dist /code/plugin-transpiler/dist
COPY --from=plugin-server-build --chown=posthog:posthog /code/plugin-server/dist /code/plugin-server/dist
COPY --from=plugin-server-build --chown=posthog:posthog /code/plugin-server/node_modules /code/plugin-server/node_modules
COPY --from=plugin-server-build --chown=posthog:posthog /code/plugin-server/package.json /code/plugin-server/package.json


# Copy the Python dependencies and Django staticfiles from the posthog-build stage.
COPY --from=posthog-build --chown=posthog:posthog /code/staticfiles /code/staticfiles
COPY --from=posthog-build --chown=posthog:posthog /python-runtime /python-runtime
Expand Down
1 change: 1 addition & 0 deletions cypress.e2e.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default defineConfig({
// cypress default is 'top' this means sometimes the element is underneath the top navbar
// not what a human would do... so, set it to center to avoid this weird behavior
scrollBehavior: 'center',
retries: {runMode: 2},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
Expand Down
32 changes: 15 additions & 17 deletions cypress/e2e/alerts.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ describe('Alerts', () => {
cy.contains('Manage alerts').click()
cy.contains('New alert').click()

cy.get('[data-attr=alert-name]').clear().type(name)
cy.get('[data-attr=alertForm-name]').clear().type(name)
cy.get('[data-attr=subscribed-users').click().type('{downarrow}{enter}')
cy.get('[data-attr=alert-lower-threshold').clear().type(lowerThreshold)
cy.get('[data-attr=alert-upper-threshold').clear().type(upperThreshold)
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()
cy.get('.Toastify__toast-body').should('contain', 'Alert saved')
cy.get('.Toastify__toast-body').should('contain', 'Alert created.')
cy.url().should('not.include', '/new')
cy.get('[data-attr=alert-list-item]').contains(name).should('exist')

cy.get('[aria-label="close"]').click()
cy.contains('span', 'Close').click()
}

const setInsightDisplayTypeAndSave = (displayType: string): void => {
Expand All @@ -57,10 +58,11 @@ describe('Alerts', () => {
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=alert-name]').should('have.value', 'Alert name')
cy.get('[data-attr=alert-lower-threshold').should('have.value', '100')
cy.get('[data-attr=alert-upper-threshold').should('have.value', '200')
cy.get('[data-attr=alertForm-name]').should('have.value', 'Alert name')
cy.get('[data-attr=alertForm-lower-threshold').should('have.value', '100')
cy.get('[data-attr=alertForm-upper-threshold').should('have.value', '200')
cy.contains('Delete alert').click()
cy.wait(2000)

cy.reload()
cy.contains('Alert name').should('not.exist')
Expand All @@ -72,22 +74,18 @@ describe('Alerts', () => {
createAlert('Alert to be deleted because of a changed insight')

cy.get('[data-attr=insight-edit-button]').click()
cy.get('[data-attr=chart-filter]').click()
cy.contains('Line chart').click()
cy.contains('span', 'Funnels').click()

cy.contains('the existing alerts will be deleted').should('exist')

cy.get('[data-attr=chart-filter]').click()
cy.contains('Number').click()

// Assert that reverting the display type removes the banner
cy.contains('span', 'Trends').click()
cy.contains('the existing alerts will be deleted').should('not.exist')

cy.get('[data-attr=insight-cancel-edit-button]').click()
setInsightDisplayTypeAndSave('Line chart')
setInsightDisplayTypeAndSave('Number')

// Assert that saving an insight in an incompatible state removes alerts
cy.contains('span', 'Funnels').click()
cy.get('[data-attr=insight-save-button]').contains('Save').click()

cy.get('[data-attr=more-button]').click()
cy.contains('Manage alerts').click()
cy.contains('Alert to be deleted because of a changed insight').should('not.exist')
Expand Down
6 changes: 5 additions & 1 deletion cypress/productAnalytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ export const insight = {
cy.get('[data-attr=taxonomic-filter-searchfield]').click()
cy.get('[data-attr=prop-filter-event_properties-1]').click({ force: true })
cy.get('[data-attr=prop-val]').click()
cy.get('[data-attr=prop-val-0]').click({ force: true })
cy.get('body').then(($body) => {
if ($body.find('[data-attr=prop-val-0]').length === 0) {
cy.get('[data-attr=taxonomic-value-select]').click()
}
})
},
editName: (insightName: string): void => {
if (insightName) {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ services:
# Note: please keep the default version in sync across
# `posthog` and the `charts-clickhouse` repos
#
image: ${CLICKHOUSE_SERVER_IMAGE:-clickhouse/clickhouse-server:23.12.6.19-alpine}
image: ${CLICKHOUSE_SERVER_IMAGE:-clickhouse/clickhouse-server:23.12.6.19}
restart: on-failure

zookeeper:
Expand Down
4 changes: 3 additions & 1 deletion docker/clickhouse/docker-entrypoint-initdb.d/init-db.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash
set -e

apk add python3
apt-get update
apt-get -y install python3.9
ln -s /usr/bin/python3.9 /usr/bin/python3
cp -r /idl/* /var/lib/clickhouse/format_schemas/
28 changes: 18 additions & 10 deletions docker/clickhouse/user_defined_function.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<function>
<type>executable</type>
<name>aggregate_funnel</name>
<return_type>Array(Tuple(Int8, Nullable(String), Array(Float64)))</return_type>
<return_type>Array(Tuple(Int8, Nullable(String), Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
Expand All @@ -25,17 +25,18 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), Nullable(String), Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel.py</command>
<command>aggregate_funnel</command>
<lifetime>600</lifetime>
</function>

<function>
<type>executable</type>
<name>aggregate_funnel_cohort</name>
<return_type>Array(Tuple(Int8, UInt64, Array(Float64)))</return_type>
<return_type>Array(Tuple(Int8, UInt64, Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
Expand All @@ -58,17 +59,18 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), UInt64, Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UUID, UInt64, Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel_cohort.py</command>
<command>aggregate_funnel</command>
<lifetime>600</lifetime>
</function>

<function>
<type>executable</type>
<name>aggregate_funnel_array</name>
<return_type>Array(Tuple(Int8, Array(String), Array(Float64)))</return_type>
<return_type>Array(Tuple(Int8, Array(String), Array(Float64), Array(Array(UUID))))</return_type>
<return_name>result</return_name>
<argument>
<type>UInt8</type>
Expand All @@ -91,11 +93,12 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), Array(String), Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UUID, Array(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel_array.py</command>
<command>aggregate_funnel</command>
<lifetime>600</lifetime>
</function>

<function>
Expand Down Expand Up @@ -124,11 +127,12 @@
<name>prop_vals</name>
</argument>
<argument>
<type>Array(Tuple(Nullable(Float64), Nullable(String), Array(Int8)))</type>
<type>Array(Tuple(Nullable(Float64), UUID, Nullable(String), Array(Int8)))</type>
<name>value</name>
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel_test.py</command>
<lifetime>600</lifetime>
</function>

<function>
Expand Down Expand Up @@ -170,6 +174,7 @@
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel_trends.py</command>
<lifetime>600</lifetime>
</function>

<function>
Expand Down Expand Up @@ -208,6 +213,7 @@
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel_array_trends.py</command>
<lifetime>600</lifetime>
</function>

<function>
Expand Down Expand Up @@ -246,6 +252,7 @@
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel_cohort_trends.py</command>
<lifetime>600</lifetime>
</function>

<function>
Expand Down Expand Up @@ -283,5 +290,6 @@
</argument>
<format>JSONEachRow</format>
<command>aggregate_funnel_array_trends_test.py</command>
<lifetime>600</lifetime>
</function>
</functions>
Loading

0 comments on commit a4cc671

Please sign in to comment.