Skip to content

Commit

Permalink
Merge branch 'master' into surveys-widget
Browse files Browse the repository at this point in the history
  • Loading branch information
liyiy committed Dec 12, 2023
2 parents cc37737 + 2a4be26 commit a1daca0
Show file tree
Hide file tree
Showing 275 changed files with 5,054 additions and 2,529 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module.exports = {
},
],
'react/forbid-dom-props': [
'warn',
'error',
{
forbid: [
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/storybook-chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
run: pnpm install http-server wait-on

- name: Build Storybook
run: pnpm build-storybook --quiet # Silence since progress logging results in a massive wall of spam
run: pnpm build-storybook --test --quiet # Silence since progress logging results in a massive wall of spam

- name: Serve Storybook in the background
run: |
Expand Down
2 changes: 2 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const config: StorybookConfig = {
docs: {
autodocs: 'tag',
},

typescript: { reactDocgen: 'react-docgen' }, // Shouldn't be needed in Storybook 8
}

export default config
33 changes: 14 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,21 @@
- Gather insights by capturing session replays, console logs, and network monitoring
- Improve your product with A/B testing that automatically analyzes performance
- Safely roll out features to select users or cohorts with feature flags
- Send out fully customizable surveys to specific cohorts of users
- Connect to external services and manage data flows with PostHog CDP

PostHog is available with hosting in the EU or US and is fully SOC 2 compliant. It's free to get started and your first 1 million events (and 15k replays) are free every month. We're constantly adding new features, such as user surveys!
PostHog is available with hosting in the EU or US and is fully SOC 2 compliant. It's free to get started and comes with a generous monthly free tier:
- 1 million product analytics events
- 15k session replays
- 1 million feature flag requests
- 250 survey responses

We're constantly adding new features, with web analytics and data warehouse now in beta!

## Table of Contents

- [Get started for free](#get-started-for-free)
- [Features](#features)
- [Docs and support](#docs-and-support)
- [Docs](#docs)
- [Contributing](#contributing)
- [Philosophy](#philosophy)
- [Open-source vs paid](#open-source-vs-paid)
Expand All @@ -49,11 +55,9 @@ You can deploy a hobby instance in one line on Linux with Docker (recommended 4G
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/posthog/posthog/HEAD/bin/deploy-hobby)"
```

Open source deployments should scale to approximately 100k events per month, after which we recommend migrating to a PostHog Cloud instance. See our [docs for more info and limitations](https://posthog.com/docs/self-host/open-source/deployment).

PostHog has [sunset support for self-hosted K8s deployments](https://posthog.com/blog/sunsetting-helm-support-posthog).
Open source deployments should scale to approximately 100k events per month, after which we recommend migrating to a PostHog Cloud instance. See our [docs for more info and limitations](https://posthog.com/docs/self-host/open-source/deployment). Please note that we do not provide customer support for open source deployments.

## Features
## Docs
![ui-demo](https://user-images.githubusercontent.com/85295485/144591577-fe97e4a5-5631-4a60-a684-45caf421507f.gif)
<p align="center">Want to find out more? <a href="https://posthog.com/book-a-demo">Request a demo!</a>

Expand All @@ -64,12 +68,13 @@ PostHog brings all the tools and data you need to build better products.
- **Event-based analytics:** Capture your product's usage [automatically](https://posthog.com/docs/integrate/client/js#autocapture), or [customize](https://posthog.com/docs/integrate) it to your needs
- **User and group tracking:** Understand the [people](https://posthog.com/manual/persons) and [groups](https://posthog.com/manual/group-analytics) behind the events and track properties about them
- **Data visualizations:** Create and share [graphs](https://posthog.com/docs/features/trends), [funnels](https://posthog.com/docs/features/funnels), [paths](https://posthog.com/docs/features/paths), [retention](https://posthog.com/docs/features/retention), and [dashboards](https://posthog.com/docs/features/dashboards)
- **SQL access:** Use SQL to get a deeper understanding of your users, breakdown information and create completely tailored visualizations
- **SQL access:** Use [SQL](https://posthog.com/docs/product-analytics/sql) to get a deeper understanding of your users, breakdown information and create completely tailored visualizations
- **Session replays:** [Watch videos](https://posthog.com/docs/features/session-recording) of your users' behavior, with fine-grained filters and privacy controls, as well as network monitoring and captured console logs
- **Heatmaps:** See where users click and get a visual representation of their behaviour with the [PostHog Toolbar](https://posthog.com/docs/features/toolbar)
- **Feature flags:** Test and manage the rollout of new features to specific users and groups, or deploy flags as kill-switches
- **Feature flags:** Test and manage the rollout of [new features](https://posthog.com/docs/feature-flags/installation) to specific users and groups, or deploy flags as kill-switches
- **A/B and multivariate experimentation:** run simple or complex changes as [experiments](https://posthog.com/manual/experimentation) and get automatic significance calculations
- **Correlation analysis:** Discover what events and properties [correlate](https://posthog.com/manual/correlation) with success and failure
- **Surveys:** Collect qualitative feedback from your users using fully customizable [surveys](https://posthog.com/docs/surveys/installation)

### Data and infrastructure tools

Expand All @@ -79,16 +84,6 @@ PostHog brings all the tools and data you need to build better products.

[Read a full list of PostHog features](https://posthog.com/product).

## Docs and support

Read how to [integrate](https://posthog.com/docs/integrate), and [extend](https://posthog.com/docs/apps) an open-source 'Hobby' deployment of PostHog in our [documentation](https://posthog.com/docs).

Check out our [tutorials](https://posthog.com/docs/apps) for step-by-step guides, how-to's, and best practices.

Learn more about getting the most out of PostHog's features in [our product manual](https://posthog.com/using-posthog).

[Ask a question](https://posthog.com/questions) to get support.

## Contributing

We <3 contributions big and small. In priority order (although everything is appreciated) with the most helpful first:
Expand Down
46 changes: 28 additions & 18 deletions bin/unit_metrics.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import http.client
import json
import time
import logging
from prometheus_client import CollectorRegistry, Gauge, multiprocess, generate_latest


logger = logging.getLogger(__name__)

UNIT_CONNECTIONS_ACCEPTED_TOTAL = Gauge(
"unit_connections_accepted_total",
"",
Expand Down Expand Up @@ -42,32 +47,37 @@


def application(environ, start_response):
connection = http.client.HTTPConnection("localhost:8181")
connection.request("GET", "/status")
response = connection.getresponse()
retries = 5
try:
connection = http.client.HTTPConnection("localhost:8181")
connection.request("GET", "/status")
response = connection.getresponse()

statj = json.loads(response.read())
connection.close()
statj = json.loads(response.read())
except Exception as e:
if retries > 0:
retries -= 1
time.sleep(1)
return application(environ, start_response)
else:
raise e
finally:
try:
connection.close()
except Exception as e:
logger.error("Failed to close connection to unit: ", e)

UNIT_CONNECTIONS_ACCEPTED_TOTAL.set(statj["connections"]["accepted"])
UNIT_CONNECTIONS_ACTIVE.set(statj["connections"]["active"])
UNIT_CONNECTIONS_IDLE.set(statj["connections"]["idle"])
UNIT_CONNECTIONS_CLOSED.set(statj["connections"]["closed"])
UNIT_CONNECTIONS_TOTAL.set(statj["requests"]["total"])

for application in statj["applications"].keys():
UNIT_PROCESSES_RUNNING_GAUGE.labels(application=application).set(
statj["applications"][application]["processes"]["running"]
)
UNIT_PROCESSES_STARTING_GAUGE.labels(application=application).set(
statj["applications"][application]["processes"]["starting"]
)
UNIT_PROCESSES_IDLE_GAUGE.labels(application=application).set(
statj["applications"][application]["processes"]["idle"]
)
UNIT_REQUESTS_ACTIVE_GAUGE.labels(application=application).set(
statj["applications"][application]["requests"]["active"]
)
for app in statj["applications"].keys():
UNIT_PROCESSES_RUNNING_GAUGE.labels(application=app).set(statj["applications"][app]["processes"]["running"])
UNIT_PROCESSES_STARTING_GAUGE.labels(application=app).set(statj["applications"][app]["processes"]["starting"])
UNIT_PROCESSES_IDLE_GAUGE.labels(application=app).set(statj["applications"][app]["processes"]["idle"])
UNIT_REQUESTS_ACTIVE_GAUGE.labels(application=app).set(statj["applications"][app]["requests"]["active"])

start_response("200 OK", [("Content-Type", "text/plain")])
# Create the prometheus multi-process metric registry here
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/notebooks.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ describe('Notebooks', () => {

it('Can comment on a recording', () => {
cy.visit(urls.replay())
cy.get('[data-attr="notebooks-add-button"]').click()

cy.get('.LemonButton').contains('New notebook').click()
cy.get('[data-attr="notebooks-add-button"]').click()
cy.get('[data-attr="notebooks-select-button-create"]').click()

cy.get('.Notebook.Notebook--editable').should('be.visible')
cy.get('.ph-recording.NotebookNode').should('be.visible')
Expand Down
17 changes: 17 additions & 0 deletions ee/api/test/test_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,20 @@ def test_feature_available_self_hosted_license_expired(self, patch_post):
self.organization.refresh_from_db()
self.assertFalse(self.organization.is_feature_available("whatever"))
License.PLANS = current_plans

def test_get_organization_restricted_teams_hidden(self):
self.organization_membership.level = OrganizationMembership.Level.MEMBER
self.organization_membership.save()
Team.objects.create(
organization=self.organization,
name="FORBIDDEN",
access_control=True,
)

response = self.client.get(f"/api/organizations/{self.organization.id}")

self.assertEqual(response.status_code, 200)
self.assertListEqual(
[team["name"] for team in response.json()["teams"]],
[self.team.name], # "FORBIDDEN" excluded
)
2 changes: 1 addition & 1 deletion ee/clickhouse/models/test/__snapshots__/test_property.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
---
# name: test_parse_groups_persons_edge_case_with_single_filter
<class 'tuple'> (
'AND ( has(%(vglobalperson_0)s, "pmat_email"))',
'AND ( has(%(vglobalperson_0)s, replaceRegexpAll(JSONExtractRaw(person_props, %(kglobalperson_0)s), \'^"|"$\', \'\')))',
<class 'dict'> {
'kglobalperson_0': 'email',
'vglobalperson_0': <class 'list'> [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# name: ClickhouseTestExperimentSecondaryResults.test_basic_secondary_metric_results
'
/* user_id:131 celery:posthog.celery.sync_insight_caching_state */
/* user_id:132 celery:posthog.celery.sync_insight_caching_state */
SELECT team_id,
date_diff('second', max(timestamp), now()) AS age
FROM events
Expand Down
Loading

0 comments on commit a1daca0

Please sign in to comment.