Skip to content

: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.

feat(metrics): add metrics to the new insight menu in the navigation (#113102)

Frank Hamand8bd35d5b7068
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 11385a6b1238..5e5b415ec165 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -647,6 +647,7 @@ export const INSIGHT_VISUAL_ORDER = {
lifecycle: 60,
calendarHeatmap: 70,
sql: 80,
+ metrics: 85,
hog: 90,
}
diff --git a/frontend/src/products.tsx b/frontend/src/products.tsx
index 72857f616971..1e7c0bbb84d0 100644
--- a/frontend/src/products.tsx
+++ b/frontend/src/products.tsx
@@ -21,6 +21,7 @@ import {
HogQLFilters,
HogQLQuery,
HogQLVariable,
+ MetricsQuery,
Node,
NodeKind,
ProductItemCategory,
@@ -2081,6 +2082,17 @@ export const getTreeItemsNew = (): FileSystemImport[] => [
visualOrder: INSIGHT_VISUAL_ORDER.lifecycle,
sceneKeys: ['Insight'],
},
+ {
+ path: `Insight/Metrics`,
+ type: 'insight',
+ href: urls.insightNew({
+ query: { kind: NodeKind.MetricsQuery, clauses: [], dateRange: { date_from: '-1h' } } as MetricsQuery,
+ }),
+ flag: FEATURE_FLAGS.METRICS_INSIGHT_BUILDER,
+ iconType: 'metrics',
+ visualOrder: INSIGHT_VISUAL_ORDER.metrics,
+ sceneKeys: ['Insight'],
+ },
{
path: `Insight/Retention`,
type: 'insight',
diff --git a/products/metrics/manifest.tsx b/products/metrics/manifest.tsx
index 61f57ed41a87..516b1813ab4c 100644
--- a/products/metrics/manifest.tsx
+++ b/products/metrics/manifest.tsx
@@ -1,6 +1,7 @@
+import { FEATURE_FLAGS, INSIGHT_VISUAL_ORDER } from 'lib/constants'
import { urls } from 'scenes/urls'
-import { ProductItemCategory, ProductKey } from '~/queries/schema/schema-general'
+import { MetricsQuery, NodeKind, ProductItemCategory, ProductKey } from '~/queries/schema/schema-general'
import { FileSystemIconColor, ProductManifest } from '~/types'
export const manifest: ProductManifest = {
@@ -25,7 +26,19 @@ export const manifest: ProductManifest = {
metrics: (): string => '/metrics',
},
fileSystemTypes: {},
- treeItemsNew: [],
+ treeItemsNew: [
+ {
+ path: `Insight/Metrics`,
+ type: 'insight',
+ href: urls.insightNew({
+ query: { kind: NodeKind.MetricsQuery, clauses: [], dateRange: { date_from: '-1h' } } as MetricsQuery,
+ }),
+ flag: FEATURE_FLAGS.METRICS_INSIGHT_BUILDER,
+ iconType: 'metrics',
+ visualOrder: INSIGHT_VISUAL_ORDER.metrics,
+ sceneKeys: ['Insight'],
+ },
+ ],
treeItemsProducts: [
{
path: 'Metrics',