Skip to content

Commit 4e15ad3

Browse files
authored
docs: update posthog docs and availability (langfuse#539)
1 parent b424052 commit 4e15ad3

File tree

5 files changed

+123
-13
lines changed

5 files changed

+123
-13
lines changed

components/availability.tsx

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import { Check, X } from "lucide-react";
2+
3+
const plans = [
4+
{ id: "hobby", label: "Hobby" },
5+
{ id: "pro", label: "Pro" },
6+
{ id: "team", label: "Team" },
7+
{ id: "selfHosted", label: "Self Hosted" },
8+
] as const;
9+
10+
const availabilities = [
11+
{ id: "full", label: "Full", Icon: Check },
12+
{ id: "private-beta", label: "Private Beta", Icon: Check },
13+
{ id: "public-beta", label: "Public Beta", Icon: Check },
14+
{ id: "not-available", label: "Not Available", Icon: X },
15+
] as const;
16+
17+
export function AvailabilitySidebar(props: {
18+
frontMatter: Record<string, any>;
19+
}) {
20+
const relevantFrontMatter = Object.entries(props.frontMatter)
21+
.filter(([key, value]) => key.startsWith("availability"))
22+
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {});
23+
24+
if (Object.keys(relevantFrontMatter).length === 0) return null;
25+
26+
return (
27+
<div className="flex flex-col space-y-2 text-primary/60 w-full align-middle border-y py-2">
28+
<div className="font-bold">Availability</div>
29+
<ul className="flex flex-col space-y-1">
30+
{plans
31+
.filter((plan) => `availability.${plan.id}` in relevantFrontMatter)
32+
.map((plan) => {
33+
const availability = availabilities.find(
34+
(availability) =>
35+
relevantFrontMatter[`availability.${plan.id}`] ===
36+
availability.id
37+
);
38+
if (!availability) return null;
39+
return (
40+
<li key={plan.id} className="flex flex-row gap-2">
41+
<availability.Icon className="w-4 h-4 inline-block" />
42+
<div className="font-bold">{plan.label}</div>
43+
<div>{availability.label}</div>
44+
</li>
45+
);
46+
})}
47+
</ul>
48+
</div>
49+
);
50+
}
51+
52+
export function AvailabilityBanner(props: {
53+
availability: Record<
54+
(typeof plans)[number]["id"],
55+
(typeof availabilities)[number]["id"]
56+
>;
57+
}) {
58+
const availablePlans = plans
59+
.filter((plan) => plan.id in props.availability)
60+
.map((plan) => ({
61+
...plan,
62+
availability: availabilities.find(
63+
(availability) => availability.id === props.availability[plan.id]
64+
),
65+
}));
66+
67+
return (
68+
<div className="border-t border-b py-3 my-4">
69+
<div className="font-semibold text-primary/60 mb-2">
70+
Where is this feature available?
71+
</div>
72+
<ul className="flex flex-row gap-2 w-full justify-between">
73+
{availablePlans.map((plan) => (
74+
<li key={plan.id} className="flex flex-col gap-1">
75+
<div className="font-bold">{plan.label}</div>
76+
<div>
77+
<plan.availability.Icon className="w-4 h-4 inline-block mr-1 lg:mr-2" />
78+
<span className="hidden md:inline-block text-xs lg:text-sm">
79+
{plan.availability.label}
80+
</span>
81+
</div>
82+
</li>
83+
))}
84+
</ul>
85+
</div>
86+
);
87+
}

pages/docs/analytics/posthog.mdx

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
---
22
description: Display your Langfuse metrics in Posthog dashboards.
3+
availability.hobby: public-beta
4+
availability.pro: public-beta
5+
availability.team: public-beta
6+
availability.selfHosted: not-available
37
---
48

59
# PostHog Integration (Beta)
610

11+
<AvailabilityBanner
12+
availability={{
13+
hobby: "public-beta",
14+
pro: "public-beta",
15+
team: "public-beta",
16+
selfHosted: "not-available",
17+
}}
18+
/>
19+
720
import { CloudflareVideo } from "@/components/Video";
821

922
[PostHog](https://posthog.com) is a popular choice for OSS product analytics. While Langfuse offers [analytics](/docs/analytics) out of the box, many of our users have asked for a way to **integrate their LLM related metrics that they capture with Langfuse into their PostHog dashboards**.
@@ -25,24 +38,27 @@ We've built an integration to make it easy to answer questions like:
2538

2639
## Get started
2740

28-
import { Callout } from "nextra/components";
41+
<Steps>
2942

30-
<Callout type="info" emoji="ℹ️">
31-
This is a beta feature and currently only available for users of our managed
32-
service.
33-
</Callout>
43+
### Enable the integration
3444

35-
Interested to use this integration for your Langfuse project? Reach out to us: early-access@langfuse.com
45+
Configure this integration in your Langfuse project settings. You will need to provide your PostHog Hostname and API key.
46+
47+
<Frame border className="max-w-lg block">
48+
![Posthog Integration Settings](/images/docs/posthog-settings.png)
49+
</Frame>
3650

37-
## Build a dashboard in PostHog
51+
### Build a dashboard in PostHog
3852

39-
Once integrated, you can build a dashboard in PostHog to visualize your Langfuse metrics. Use the _AI Metrics_ template to get started with a pre-built dashboard that includes the most common metrics from Langfuse.
53+
Once integrated, you can build a dashboard in PostHog to visualize your Langfuse metrics (see [reference below](#details)). Use the _AI Metrics_ template to get started with a pre-built dashboard that includes the most common metrics from Langfuse.
4054

4155
<Frame border className="max-w-xs block">
4256
![PostHog Dashboard Template](/images/docs/posthog-template.png)
4357
</Frame>
4458

45-
## Integration details
59+
</Steps>
60+
61+
## Integration details [#details]
4662

4763
On a daily schedule Langfuse batches aggregated events and metrics to your PostHog instance.
4864

@@ -120,7 +136,3 @@ You can decide which events you want to send to PostHog. By default, we send all
120136
- `langfuse_release`: The release information of the trace associated with the score.
121137
- `langfuse_tags`: Any tags related to the trace of the score.
122138
- `langfuse_integration_version`: The integration version with LangFuse.
123-
124-
## Questions?
125-
126-
If you have any questions about this integration, please reach out to us at early-access@langfuse.com
39.5 KB
Loading

src/overrides.css

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
.nextra-toc>div> :last-child {
1111
fill-opacity: 50;
12+
padding-top: 0.5rem;
13+
padding-bottom: 0.5rem;
1214
}
1315

1416
/* smaller search bar */

theme.config.tsx

+9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ import IconDiscord from "./components/icons/discord";
2020
import FooterMenu from "./components/FooterMenu";
2121
import Link from "next/link";
2222
import { FileCode, LibraryBig } from "lucide-react";
23+
import {
24+
AvailabilityBanner,
25+
AvailabilitySidebar,
26+
} from "./components/availability";
2327

2428
const config: DocsThemeConfig = {
2529
logo: <Logo />,
@@ -106,6 +110,10 @@ const config: DocsThemeConfig = {
106110
},
107111
toc: {
108112
backToTop: true,
113+
extraContent: () => {
114+
const { frontMatter } = useConfig();
115+
return <AvailabilitySidebar frontMatter={frontMatter} />;
116+
},
109117
},
110118
docsRepositoryBase: "https://github.com/langfuse/langfuse-docs/tree/main",
111119
footer: {
@@ -214,6 +222,7 @@ const config: DocsThemeConfig = {
214222
Steps,
215223
Card,
216224
Cards,
225+
AvailabilityBanner,
217226
},
218227
banner: {
219228
key: "launch-week",

0 commit comments

Comments
 (0)