PostHog / PostHog/posthog

Lineage for Insights, Dashboards, and Notebooks

Open
#66,075 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Feature request

Is your feature request related to a problem?

There is a lack of visibility of how changes in on component will effect other components.

Describe the solution you'd like

The Lineage feature for Models (Views) is amazing. I would love to see a similar feature come to Insights, Dashboards, and Notebooks. For Insights, I would love to see downstream dependencies as well as upstream dependencies like requested for Views in #66069.

Ideally, this would show nested dependencies in both directions.

Describe alternatives you've considered

I am currently using the query below to see downstream dependencies for Insights:

-- Update search_term with Insight name

WITH 
'EXAMPLE' as search_term,
target_insight AS (
    SELECT i.id, i.short_id, i.name
    FROM system.insights i
    WHERE i.name ILIKE concat('%', search_term, '%')
      AND i.deleted = 0
)

-- Dashboards containing the insight
SELECT
    'Dashboard'                 AS container_type,
    d.name                      AS container_name,
    toString(d.id)              AS container_id,
    i.short_id                  AS insight_short_id,
    i.name                      AS insight_name
FROM target_insight i
JOIN (SELECT * FROM system.dashboard_tiles WHERE deleted = 0) dt ON dt.insight_id = i.id
JOIN (SELECT * FROM system.dashboards WHERE deleted = 0) d       ON d.id = dt.dashboard_id

UNION ALL

-- Notebooks containing the insight (matched by short_id in content JSON)
SELECT
    'Notebook'                                   AS container_type,
    n.title                                      AS container_name,
    n.short_id                                   AS container_id,
    i.short_id                                   AS insight_short_id,
    i.name                                       AS insight_name
FROM target_insight i
CROSS JOIN system.notebooks n
WHERE toString(n.content) LIKE concat('%', i.short_id, '%')
  AND n.deleted = 0

ORDER BY container_type, container_name

LIMIT 100
Debug info
- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by studying the existing lineage feature for Models (Views) and the upstream-dependencies request in #66069; this issue names no files or tests. Define how lineage should work for Insights, Dashboards, and Notebooks, including nested upstream and downstream dependencies, then verify the resulting relationships in both directions.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
analytics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.