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): show the SDK install paths in the metrics empty state (#88590)

Daniel Viscac0976e0fb684
diff --git a/products/metrics/frontend/components/MetricsSetupPrompt.tsx b/products/metrics/frontend/components/MetricsSetupPrompt.tsx
index 2d9dc4a394ca..fcfef27e54b3 100644
--- a/products/metrics/frontend/components/MetricsSetupPrompt.tsx
+++ b/products/metrics/frontend/components/MetricsSetupPrompt.tsx
@@ -10,6 +10,9 @@ import { CodeSnippet, Language } from 'lib/components/CodeSnippet'
import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
import { useInterval } from 'lib/hooks/useInterval'
import { apiHostOrigin } from 'lib/utils/apiHost'
+import javascriptImage from 'scenes/onboarding/shared/logos/javascript_web.svg'
+import nodejsImage from 'scenes/onboarding/shared/logos/nodejs.svg'
+import pythonImage from 'scenes/onboarding/shared/logos/python.svg'
import { teamLogic } from 'scenes/teamLogic'
import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
@@ -18,6 +21,20 @@ import { metricsIngestionLogic } from '../metricsIngestionLogic'
const HedgehogGreek = pngHoggie(greekPng)
+// The SDK paths come first: a product engineer on a PaaS reaches for the SDK they
+// already have, where the scrape agent below needs infra they may not run. The
+// agent's own Docker and Kubernetes paths are the tabbed snippets, not links.
+const FRAMEWORK_LINKS: { name: string; image?: string; docsLink: string }[] = [
+ {
+ name: 'JavaScript',
+ image: javascriptImage,
+ docsLink: 'https://posthog.com/docs/metrics/installation/javascript',
+ },
+ { name: 'Node.js', image: nodejsImage, docsLink: 'https://posthog.com/docs/metrics/installation/nodejs' },
+ { name: 'Python', image: pythonImage, docsLink: 'https://posthog.com/docs/metrics/installation/python' },
+ { name: 'Other', docsLink: 'https://posthog.com/docs/metrics/installation/other' },
+]
+
const POLLING_INTERVAL_MS = 5000
export const MetricsSetupPrompt = ({
@@ -98,7 +115,7 @@ const NoMetricsPrompt = ({ className }: { className?: string }): JSX.Element | n
productName="Metrics"
thingName="metric"
titleOverride="You haven't sent any metrics yet"
- description="PostHog metrics works with any OpenTelemetry-compatible client. You don't need any PostHog-specific packages – just use standard OpenTelemetry libraries to send metrics via OTLP."
+ description="Send metrics from the PostHog SDK you already have, from any OpenTelemetry-compatible client over OTLP, or by scraping the Prometheus endpoints you already expose."
isEmpty={true}
productKey={ProductKey.METRICS}
className={className}
@@ -109,8 +126,8 @@ const NoMetricsPrompt = ({ className }: { className?: string }): JSX.Element | n
Read our{' '}
<Link to="https://posthog.com/docs/metrics" onClick={() => onDocsLinkClick('Metrics')}>
metrics docs
- </Link>{' '}
- or learn more about{' '}
+ </Link>
+ , learn more about{' '}
<Link
to="https://opentelemetry.io/docs/what-is-opentelemetry/"
target="_blank"
@@ -119,8 +136,26 @@ const NoMetricsPrompt = ({ className }: { className?: string }): JSX.Element | n
>
OpenTelemetry
</Link>
- .
+ , or pick a language to get started:
</p>
+ <div className="flex flex-wrap gap-2">
+ {FRAMEWORK_LINKS.map(({ name, image, docsLink }) => (
+ <LemonButton
+ key={name}
+ type="secondary"
+ size="small"
+ to={docsLink}
+ onClick={() => onDocsLinkClick(name)}
+ icon={
+ image ? (
+ <img src={image} alt="" aria-hidden="true" className="w-5 h-5" />
+ ) : undefined
+ }
+ >
+ {name}
+ </LemonButton>
+ ))}
+ </div>
<div className="flex flex-col gap-1 w-full max-w-160">
<h5 className="m-0">Or scrape your existing Prometheus metrics</h5>
<p className="text-sm text-secondary m-0">
@@ -162,22 +197,12 @@ const NoMetricsPrompt = ({ className }: { className?: string }): JSX.Element | n
]}
/>
</div>
- <div className="flex items-center gap-4">
- <div className="flex items-center gap-2 px-3 py-1.5 border border-accent rounded">
- <div className="relative flex items-center justify-center">
- <div className="absolute w-3 h-3 border-2 border-accent rounded-full animate-ping" />
- <div className="w-2 h-2 bg-accent rounded-full" />
- </div>
- <span className="text-sm">Watching for metrics</span>
+ <div className="flex items-center gap-2 px-3 py-1.5 border border-accent rounded">
+ <div className="relative flex items-center justify-center">
+ <div className="absolute w-3 h-3 border-2 border-accent rounded-full animate-ping" />
+ <div className="w-2 h-2 bg-accent rounded-full" />
</div>
- <LemonButton
- type="secondary"
- size="small"
- to="https://posthog.com/docs/metrics"
- onClick={() => onDocsLinkClick('Docs')}
- >
- View docs
- </LemonButton>
+ <span className="text-sm">Watching for metrics</span>
</div>
</div>
}