:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
perf(ingress): share github lookup with tasks and signals (#114468)
Meikel Ratzf51dca8ffc69
diff --git a/posthog/github/README.md b/posthog/github/README.mdindex c270b1126600..317b40ef26ff 100644--- a/posthog/github/README.md+++ b/posthog/github/README.md@@ -4,7 +4,7 @@ Code about GitHub that more than one product needs and that is neither transportInbound transport is `posthog/ingress/github/`, outbound calls are `posthog/egress/github/`, and neither imports the other.Both may import this package.-- `installations.py` reads the installation id off a payload and resolves the teams linked to it. Consumers call `installation_integrations()` for that, which runs one capped query.+- `installations.py` reads the installation id off a payload and resolves the teams linked to it. Consumers call `installation_integrations()` or `installation_team_ids()` for that, which runs one capped query.- `attribution.py` resolves a GitHub login to an organization member, under a bounded statement timeout, so a slow lookup degrades to no attribution.- `pull_request_events.py` emits the canonical `pr_created`, `pr_closed`, `pr_merged` and `pr_reviewed` analytics events.- `metrics.py` holds the Prometheus counters for dropped events and attribution outcomes.diff --git a/posthog/github/installations.py b/posthog/github/installations.pyindex e7ca49895353..caf2d82923da 100644--- a/posthog/github/installations.py+++ b/posthog/github/installations.py@@ -55,12 +55,7 @@ def installation_team_ids(payload: dict) -> list[int]:# One installation can link to several teams. The order only keeps results stable, so never treat# the first team as the owner. See posthog/ingress/github/README.md#picking-the-project.- return list(- Integration.objects.using(SCOPE_DB_ALIAS)- .filter(kind="github", integration_id=external_id)- .order_by("team_id")- .values_list("team_id", flat=True)- )+ return [integration.team_id for integration in installation_integrations(external_id)]def _resolve_external_team(payload: dict) -> Team | None:diff --git a/posthog/ingress/github/README.md b/posthog/ingress/github/README.mdindex b5a6c7e0aa11..f3036f42a577 100644--- a/posthog/ingress/github/README.md+++ b/posthog/ingress/github/README.md@@ -60,7 +60,7 @@ See `products/commands/README.md`.One installation can link to several projects in a region, so `installation.id` never names one project.A consumer picks its projects in one of two shapes.-A consumer that needs the teams behind a delivery's installation calls `installation_integrations()` from `posthog/github/installations.py`, never its own `Integration` query.+A consumer that needs the teams behind a delivery's installation calls `installation_integrations()` or `installation_team_ids()` from `posthog/github/installations.py`, never its own `Integration` query.**Subscriptions.**Deliver the event to every project that has its own row for the repository, for example a workflow, a loop trigger, an issue link, or a monitored repository.