Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hackathon metalytics (tracking team usage metrics) #26304

Merged
merged 60 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
faf9a05
wip
benjackwhite Nov 20, 2024
d631978
Add actual scope info
benjackwhite Nov 20, 2024
a699ede
fix
benjackwhite Nov 20, 2024
7b3910a
feat: creating API end point that writes to kafkta
Nov 20, 2024
56dac9d
Added app metrics 2 to hogql
benjackwhite Nov 20, 2024
0e32e8e
Merge branch 'hackathon/metalytics' of github.com:PostHog/posthog int…
benjackwhite Nov 20, 2024
ac7867c
Fixes
benjackwhite Nov 20, 2024
0656952
Update query snapshots
github-actions[bot] Nov 20, 2024
987da60
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 20, 2024
99629a1
Fix
benjackwhite Nov 21, 2024
371f082
Fixes
benjackwhite Nov 21, 2024
45b0758
Merge branch 'hackathon/metalytics' of github.com:PostHog/posthog int…
benjackwhite Nov 21, 2024
8e4b622
Update UI snapshots for `webkit` (2)
github-actions[bot] Nov 21, 2024
9eff497
Update UI snapshots for `chromium` (1)
github-actions[bot] Nov 21, 2024
16cbc1b
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 21, 2024
de074f4
Fix
benjackwhite Nov 21, 2024
ed84770
Merge branch 'hackathon/metalytics' of github.com:PostHog/posthog int…
benjackwhite Nov 21, 2024
f90bbe8
feat: Add members logic and user view tracking in metalytics component
Nov 21, 2024
89961eb
refactor: Separate view count and recent users loaders in metalyticsL…
Nov 21, 2024
76736c1
refactor: Update SQL query timestamp and interval syntax in metalytic…
Nov 21, 2024
913f846
feat: Add selectors for recent user members in metalyticsLogic
Nov 21, 2024
e2ed316
feat: Add console log for recentUserMembers in metalyticsLogic
Nov 21, 2024
b866feb
Fixes
benjackwhite Nov 21, 2024
1aea873
feature: person bubbles
Nov 21, 2024
07e7d64
feat: Add new icons and IconWithCount component to MetalyticsSummary
Nov 21, 2024
bb9a16d
style: Add margin between IconPulse and IconDashboard in MetalyticsSu…
Nov 21, 2024
63f2975
Added opener
benjackwhite Nov 21, 2024
3123cbe
fix: MetalyticsSummary component
Nov 21, 2024
67cb581
pulse icon
Nov 21, 2024
5d5f4e3
adding the pulse icon
Nov 21, 2024
2d2503b
Fixes
benjackwhite Nov 21, 2024
6eb546c
Fix
benjackwhite Nov 21, 2024
2240d16
feat: Add view count display to SidePanelActivityMetalytics component
Nov 21, 2024
fe40166
feat: Add recentUserMembers to SidePanelActivityMetalytics component
Nov 21, 2024
7685d59
feat: Replace UserBasicType with ProfileBubbles in SidePanelActivityM…
Nov 21, 2024
667764c
feat: Add ProfileBubbles for recent viewers in SidePanelActivityMetal…
Nov 21, 2024
8ff1c67
refactor: Adjust recent viewers section and ProfileBubbles limit
Nov 21, 2024
3fae703
feat: Make SidePanelActivityMetalytics scrollable with max height
Nov 21, 2024
790691d
refactor: Update Metalytics activity query to include timestamp and 3…
Nov 21, 2024
8a7fdc3
refactor: Improve HogQL query indentation in SidePanelActivityMetalytics
Nov 21, 2024
ec560b3
style: Place Total Views and Recent Viewers side by side in flex cont…
Nov 21, 2024
6c21efd
feat: Add feature flag for MetalyticsSummary component in TopBar
Nov 21, 2024
20e38ba
fix: sql query, styling and remvoing feature flag code
Nov 22, 2024
6e4699b
putting things behind a feature flag
surbhi-posthog Nov 26, 2024
39e88b3
fix: fixing feature styling
surbhi-posthog Nov 26, 2024
63c4172
Fixes
benjackwhite Dec 4, 2024
a0badd2
Fix up
benjackwhite Dec 4, 2024
779704f
Fixes
benjackwhite Dec 4, 2024
e87c922
Fixes
benjackwhite Dec 4, 2024
613f039
Fix
benjackwhite Dec 4, 2024
1b06679
Fix
benjackwhite Dec 4, 2024
1b6db67
Fixes
benjackwhite Dec 4, 2024
65c2b90
Merge branch 'master' into hackathon/metalytics
benjackwhite Dec 4, 2024
6475d5d
Fix
benjackwhite Dec 4, 2024
db0021c
Fix
benjackwhite Dec 4, 2024
3df86e6
Niceties
benjackwhite Dec 4, 2024
4cbae02
Fix
benjackwhite Dec 4, 2024
f5387e8
fix
benjackwhite Dec 4, 2024
50ee5bb
Remove query
benjackwhite Dec 5, 2024
37bd9c6
Merge branch 'master' into hackathon/metalytics
benjackwhite Dec 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified frontend/__snapshots__/scenes-app-dashboards--erroring--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-dashboards--list--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-dashboards--list--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-insights--lifecycle--dark.png
Binary file modified frontend/__snapshots__/scenes-app-insights--lifecycle--light.png
Binary file modified frontend/__snapshots__/scenes-app-insights--retention--dark.png
Binary file modified frontend/__snapshots__/scenes-app-insights--retention--light.png
Binary file modified frontend/__snapshots__/scenes-app-insights--stickiness--dark.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-bar--dark.png
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-pie--dark.png
Binary file modified frontend/__snapshots__/scenes-app-insights--user-paths--dark.png
Binary file modified frontend/__snapshots__/scenes-app-notebooks--headings--dark.png
Binary file modified frontend/__snapshots__/scenes-app-notebooks--headings--light.png
1 change: 0 additions & 1 deletion frontend/src/layout/navigation-3000/components/TopBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@

.TopBar3000__actions {
display: flex;
flex-grow: 1;
gap: 0.5rem;
align-items: center;
justify-content: flex-end;
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/layout/navigation-3000/components/TopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import clsx from 'clsx'
import { useActions, useValues } from 'kea'
import { router } from 'kea-router'
import { EditableField } from 'lib/components/EditableField/EditableField'
import { MetalyticsSummary } from 'lib/components/Metalytics/MetalyticsSummary'
import { FEATURE_FLAGS } from 'lib/constants'
import { IconMenu } from 'lib/lemon-ui/icons'
import { Link } from 'lib/lemon-ui/Link'
import { Popover } from 'lib/lemon-ui/Popover/Popover'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import React, { useLayoutEffect, useState } from 'react'

import { breadcrumbsLogic } from '~/layout/navigation/Breadcrumbs/breadcrumbsLogic'
Expand All @@ -25,6 +28,7 @@ export function TopBar(): JSX.Element | null {
const { showNavOnMobile } = useActions(navigation3000Logic)
const { breadcrumbs, renameState } = useValues(breadcrumbsLogic)
const { setActionsContainer } = useActions(breadcrumbsLogic)
const { featureFlags } = useValues(featureFlagLogic)

const [compactionRate, setCompactionRate] = useState(0)

Expand Down Expand Up @@ -101,7 +105,12 @@ export function TopBar(): JSX.Element | null {
)}
<Here breadcrumb={breadcrumbs[breadcrumbs.length - 1]} isOnboarding={isOnboarding} />
</div>
<div className="TopBar3000__actions" ref={setActionsContainer} />
{featureFlags[FEATURE_FLAGS.METALYTICS] && (
<div className="shrink-1">
<MetalyticsSummary />
</div>
)}
<div className="TopBar3000__actions border-danger" ref={setActionsContainer} />
</div>
</div>
) : null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
import { ActivityScope, AvailableFeature } from '~/types'

import { SidePanelPaneHeader } from '../../components/SidePanelPaneHeader'
import { SidePanelActivityMetalytics } from './SidePanelActivityMetalytics'

const SCROLL_TRIGGER_OFFSET = 100

Expand Down Expand Up @@ -143,6 +144,14 @@ export const SidePanelActivity = (): JSX.Element => {
key: SidePanelActivityTab.All,
label: 'All activity',
},
...(featureFlags[FEATURE_FLAGS.METALYTICS]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you got it right here.

? [
{
key: SidePanelActivityTab.Metalytics,
label: 'Analytics',
},
]
: []),
]}
/>
</div>
Expand Down Expand Up @@ -204,6 +213,8 @@ export const SidePanelActivity = (): JSX.Element => {
/>
</div>
</div>
) : activeTab === SidePanelActivityTab.Metalytics ? (
<SidePanelActivityMetalytics />
) : null}
</div>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { BindLogic, useValues } from 'kea'
import { metalyticsLogic } from 'lib/components/Metalytics/metalyticsLogic'
import { ProfileBubbles } from 'lib/lemon-ui/ProfilePicture/ProfileBubbles'
import { insightLogic } from 'scenes/insights/insightLogic'

import { Query } from '~/queries/Query/Query'
import { NodeKind } from '~/queries/schema'
import { hogql } from '~/queries/utils'

export function SidePanelActivityMetalytics(): JSX.Element {
const { instanceId, viewCount, recentUserMembers } = useValues(metalyticsLogic)

if (!instanceId) {
return (
<>
<h3>Metalytics</h3>
<p>
You can see internal analytics of how your Organization members are using PostHog for certain
things.
</p>
</>
)
}

return (
<div className="space-y-4 overflow-y-auto max-h-[calc(100vh-200px)]">
<div className="flex gap-4">
<div className="flex-1 rounded bg-bg-light p-4">
<div className="text-muted text-sm">Number Of Sessions</div>
<div className="text-2xl font-semibold">{viewCount ?? 0}</div>
</div>

<div className="flex-1 rounded bg-bg-light p-4">
<div className="text-muted text-sm mb-2">Recent Viewers (30 days)</div>
<ProfileBubbles
people={recentUserMembers.map((member) => ({
email: member.user.email,
name: member.user.first_name,
title: member.user.email,
}))}
tooltip="Recent viewers"
limit={3}
/>
</div>
</div>

{/* This looks odd but is a weirdness of the Query component it needs to be bound in an insight logic */}
<BindLogic logic={insightLogic} props={{ dashboardItemId: '', doNotLoad: true }}>
<Query
query={{
display: 'ActionsLineGraph',
chartSettings: {
seriesBreakdownColumn: null,
},
kind: NodeKind.DataVisualizationNode,
source: {
kind: NodeKind.HogQLQuery,
query: hogql`SELECT timestamp, SUM(count) AS number_of_sessions
FROM app_metrics
WHERE app_source = 'metalytics'
AND instance_id = ${instanceId}
AND timestamp >= NOW() - INTERVAL 30 DAY
GROUP BY timestamp
ORDER BY timestamp DESC`,
},
}}
/>
</BindLogic>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const activityForSceneLogic = kea<activityForSceneLogicType>([
connect({
values: [sceneLogic, ['sceneConfig']],
}),

selectors({
sceneActivityFilters: [
(s) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { toParams } from 'lib/utils'
import posthog from 'posthog-js'
import { teamLogic } from 'scenes/teamLogic'

import { sidePanelStateLogic } from '../../sidePanelStateLogic'
import { ActivityFilters, activityForSceneLogic } from './activityForSceneLogic'
import type { sidePanelActivityLogicType } from './sidePanelActivityLogicType'

Expand All @@ -29,12 +30,14 @@ export interface ChangesResponse {
export enum SidePanelActivityTab {
Unread = 'unread',
All = 'all',
Metalytics = 'metalytics',
}

export const sidePanelActivityLogic = kea<sidePanelActivityLogicType>([
path(['scenes', 'navigation', 'sidepanel', 'sidePanelActivityLogic']),
connect({
values: [activityForSceneLogic, ['sceneActivityFilters']],
actions: [sidePanelStateLogic, ['openSidePanel']],
}),
actions({
togglePolling: (pageIsVisible: boolean) => ({ pageIsVisible }),
Expand Down Expand Up @@ -183,6 +186,11 @@ export const sidePanelActivityLogic = kea<sidePanelActivityLogicType>([
actions.loadOlderActivity()
}
},
openSidePanel: ({ options }) => {
if (options) {
actions.setActiveTab(options)
}
},
})),
selectors({
allActivity: [
Expand Down
31 changes: 31 additions & 0 deletions frontend/src/lib/components/Metalytics/MetalyticsSummary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { IconPulse } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { IconWithCount } from 'lib/lemon-ui/icons'

import { sidePanelStateLogic } from '~/layout/navigation-3000/sidepanel/sidePanelStateLogic'
import { SidePanelTab } from '~/types'

import { metalyticsLogic } from './metalyticsLogic'

export function MetalyticsSummary(): JSX.Element | null {
const { instanceId, viewCount, viewCountLoading } = useValues(metalyticsLogic)
const safeViewCount = viewCount ?? 0
const { openSidePanel } = useActions(sidePanelStateLogic)

if (!instanceId) {
return null
}

return (
<IconWithCount count={safeViewCount}>
<LemonButton
loading={viewCountLoading}
icon={<IconPulse />}
size="small"
onClick={() => openSidePanel(SidePanelTab.Activity, 'metalytics')}
tooltip="Click to see more usage data for this tool"
/>
</IconWithCount>
)
}
103 changes: 103 additions & 0 deletions frontend/src/lib/components/Metalytics/metalyticsLogic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { connect, kea, path, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { subscriptions } from 'kea-subscriptions'
import api from 'lib/api'
import { membersLogic } from 'scenes/organization/membersLogic'

import { activityForSceneLogic } from '~/layout/navigation-3000/sidepanel/panels/activity/activityForSceneLogic'
import { HogQLQuery, NodeKind } from '~/queries/schema'
import { hogql } from '~/queries/utils'

import type { metalyticsLogicType } from './metalyticsLogicType'

export const metalyticsLogic = kea<metalyticsLogicType>([
path(['lib', 'components', 'metalytics', 'metalyticsLogic']),
connect({
values: [activityForSceneLogic, ['sceneActivityFilters'], membersLogic, ['members']],
}),

loaders(({ values }) => ({
viewCount: [
null as number | null,
{
loadViewCount: async () => {
const query: HogQLQuery = {
kind: NodeKind.HogQLQuery,
query: hogql`SELECT sum(count) as count
FROM app_metrics
WHERE app_source = 'metalytics'
AND instance_id = ${values.instanceId}`,
}

// NOTE: I think this gets cached heavily - how to correctly invalidate?

const response = await api.query(query)
const result = response.results as number[]
return result[0]
},
},
],
recentUsers: [
[] as string[],
{
loadUsersLast30days: async () => {
const query: HogQLQuery = {
kind: NodeKind.HogQLQuery,
query: hogql`SELECT DISTINCT app_source_id
FROM app_metrics
WHERE app_source = 'metalytics'
AND instance_id = ${values.instanceId}
AND timestamp >= NOW() - INTERVAL 30 DAY
ORDER BY timestamp DESC`,
}

const response = await api.query(query)
return response.results.map((result) => result[0]) as string[]
},
},
],
})),

selectors({
instanceId: [
(s) => [s.sceneActivityFilters],
(sceneActivityFilters) =>
sceneActivityFilters
? sceneActivityFilters.item_id
? `${sceneActivityFilters.scope}:${sceneActivityFilters.item_id}`
: sceneActivityFilters.scope
: null,
],

recentUserMembers: [
(s) => [s.recentUsers, s.members],
(recentUsers, members) => {
if (!members || !recentUsers) {
return []
}
// Filter members whose IDs match the recentUsers array
const filteredMembers = members.filter((member) => recentUsers.includes(String(member.user.id)))
return filteredMembers
},
],
}),

subscriptions(({ actions }) => ({
instanceId: async (instanceId) => {
if (instanceId) {
actions.loadViewCount()
actions.loadUsersLast30days()

await api.create('/api/projects/@current/metalytics/', {
metric_name: 'viewed',
// metric_kind: 'misc',
instance_id: instanceId,

// API sets these
// app_source: 'internal_metrics',
// app_source_id: user.id,
})
}
},
})),
])
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export const FEATURE_FLAGS = {
CUSTOM_CHANNEL_TYPE_RULES: 'custom-channel-type-rules', // owner: @robbie-c #team-web-analytics
SELF_SERVE_CREDIT_OVERRIDE: 'self-serve-credit-override', // owner: @zach
EXPERIMENTS_MIGRATION_DISABLE_UI: 'experiments-migration-disable-ui', // owner: @jurajmajerik #team-experiments
METALYTICS: 'metalytics', // owner: @surbhi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to add this to prod when shipping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do i need to do anything additional to this to make sure its in prod?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just create the flag and set the release conditions. You can set to something like this so it's just available internally.

Screenshot 2024-11-26 at 2 47 41 PM

} as const
export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS]

Expand Down
15 changes: 14 additions & 1 deletion frontend/src/scenes/actions/actionLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { DataManagementTab } from 'scenes/data-management/DataManagementScene'
import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'

import { ActionType, Breadcrumb, HogFunctionType } from '~/types'
import { ActivityFilters } from '~/layout/navigation-3000/sidepanel/panels/activity/activityForSceneLogic'
import { ActionType, ActivityScope, Breadcrumb, HogFunctionType } from '~/types'

import { actionEditLogic } from './actionEditLogic'
import type { actionLogicType } from './actionLogicType'
Expand Down Expand Up @@ -104,6 +105,18 @@ export const actionLogic = kea<actionLogicType>([
(s) => [s.action],
(action) => action?.steps?.some((step) => step.properties?.find((p) => p.type === 'cohort')) ?? false,
],

activityFilters: [
(s) => [s.action],
(action): ActivityFilters | null => {
return action?.id
? {
scope: ActivityScope.ACTION,
item_id: String(action.id),
}
: null
},
],
}),
listeners(({ actions, values }) => ({
checkIsFinished: ({ action }) => {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3929,6 +3929,7 @@ export type PromptFlag = {

// Should be kept in sync with "posthog/models/activity_logging/activity_log.py"
export enum ActivityScope {
ACTION = 'Action',
FEATURE_FLAG = 'FeatureFlag',
PERSON = 'Person',
INSIGHT = 'Insight',
Expand Down
9 changes: 8 additions & 1 deletion posthog/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from rest_framework_extensions.routers import NestedRegistryItem


from posthog.api import project
from posthog.api import metalytics, project
from posthog.api.routing import DefaultRouterPlusPlus
from posthog.batch_exports import http as batch_exports
from posthog.settings import EE_AVAILABLE
Expand Down Expand Up @@ -534,6 +534,13 @@ def register_grandfathered_environment_nested_viewset(
["team_id"],
)

register_grandfathered_environment_nested_viewset(
r"metalytics",
metalytics.MetalyticsViewSet,
"environment_metalytics",
["team_id"],
)

projects_router.register(
r"insight_variables",
insight_variable.InsightVariableViewSet,
Expand Down
Loading