Add docs for Grafana's PostHog analytics integration#18132
Conversation
Grafana 13.1 added PostHog as an analytics destination for its echo service (grafana/grafana#122263). This adds a docs page covering configuration (posthog_token/posthog_host and env-var overrides), the event mapping, and identify behavior, plus a nav entry under SDKs → Services. Generated-By: PostHog Code Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286
Deploy preview
|
|
Vale prose linter → found 0 errors, 1 warnings, 0 suggestions in your markdown Full report → Copy the linter results into an LLM to batch-fix issues. Linter being weird? Update the rules!
|
| Line | Severity | Message | Rule |
|---|---|---|---|
| 6:19 | warning | Use 'Grafana' instead of 'grafana'. | Vale.Terms |
rafaeelaudibert
left a comment
There was a problem hiding this comment.
No platformLogo yet — src/constants/logos.ts has no grafana key, and adding one needs a Grafana SVG uploaded to Cloudinary first. The logo render is conditional, so the page displays fine without it. Happy to wire it up as a follow-up once the asset is uploaded.
Can you make sure this gets added to Cloudinary and appended to the PR?
Bundle reportTotal JS (gzip)6.29 MiB (+0.0 KiB / +0.0%) Eager graph (static-import closure per entrypoint)
Largest modules in the
|
| Module | Size |
|---|---|
css ./node_modules/.pnpm/css-loader@5.2.7_webpack@5.101.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[1]!./node_modules/.pnpm/postcss-loader@4.3.0_postcss@8.5.6_webpack@5.101.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[2]!./src/styles/global.css |
708.0 KiB |
./src/components/Stickers/Stickers.tsx |
696.4 KiB |
./.cache/caches/gatsby-plugin-mdx/mdx-scopes-dir/31a094f140f119e73085d847ae81b99b.js + 2 modules |
579.3 KiB |
./node_modules/.pnpm/@radix-ui+react-icons@1.3.2_react@18.3.1/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js |
481.4 KiB |
./node_modules/.pnpm/@codemirror+view@6.38.2/node_modules/@codemirror/view/dist/index.js |
458.1 KiB |
./node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.js + 29 modules |
395.1 KiB |
./node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.cjs.js |
364.8 KiB |
./node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js |
354.8 KiB |
./src/hooks/useCustomers.tsx + 54 modules |
353.9 KiB |
./node_modules/.pnpm/react-markdown@8.0.7_@types+react@16.14.66_react@18.3.1/node_modules/react-markdown/lib/react-markdown.js + 88 modules |
351.4 KiB |
./node_modules/.pnpm/cloudinary-core@2.14.0_lodash@4.17.21/node_modules/cloudinary-core/cloudinary-core.js |
281.9 KiB |
./src/components/ProductComparisonTable/index.tsx + 116 modules |
267.6 KiB |
./node_modules/.pnpm/@codesandbox+sandpack-react@2.20.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@codesandbox/sandpack-react/dist/index.mjs |
266.6 KiB |
./node_modules/.pnpm/d3@7.9.0/node_modules/d3/src/index.js + 208 modules |
247.4 KiB |
./src/components/Pricing/PricingSlider/Slider.tsx + 87 modules |
239.9 KiB |
Eager-graph budgets are report-only until a baseline is established. Sizes are gzip of public/**/*.js; eager size is webpack module source bytes.
…, add Grafana logo - Replace hardcoded us.posthog.com links with app.posthog.com (review feedback) - Use "project token" terminology and the <ph_project_token> placeholder per Vale linter - Add grafana key to logos.ts and wire up platformLogo frontmatter Generated-By: PostHog Code Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286
gewenyu99
left a comment
There was a problem hiding this comment.
Hey! Thanks for writing this up. The content and writing are generally good, but I have comments on structure.
Thanks for taking this on!
| ## Objective | ||
|
|
||
| Forwarding Grafana usage analytics to PostHog using Grafana's built-in PostHog analytics backend. | ||
|
|
||
| ## Why is this useful? |
There was a problem hiding this comment.
| ## Objective | |
| Forwarding Grafana usage analytics to PostHog using Grafana's built-in PostHog analytics backend. | |
| ## Why is this useful? |
We don't need this boiler plate generally.
|
|
||
| To follow this tutorial, you should: | ||
|
|
||
| 1. Have a [PostHog account](https://us.posthog.com/signup) (Cloud or self-hosted) |
There was a problem hiding this comment.
| 1. Have a [PostHog account](https://us.posthog.com/signup) (Cloud or self-hosted) | |
| 1. Have a [PostHog account](https://app.posthog.com/signup) |
| ### Can I use this with a self-hosted PostHog instance? | ||
|
|
||
| Yes! Set `posthog_host` to your self-hosted instance URL in the `[analytics]` section of your Grafana configuration. |
There was a problem hiding this comment.
We generally now keep this information in the self-hosted section of docs and in the hobby deployment repo itself. We do this because we don't offer support on self-deployed instances and it can be confusing when we have it in the general docs and do not offer support.
| 1. Have a [PostHog account](https://us.posthog.com/signup) (Cloud or self-hosted) | ||
| 2. Run a self-managed [Grafana instance](https://grafana.com/docs/grafana/latest/setup-grafana/) on version 13.1 or later | ||
|
|
||
| ## Step-by-step instructions |
There was a problem hiding this comment.
This is a comment of the general structure of this page. So this sits under https://posthog.com/docs/libraries which generally contain reference material on these libraries.
The structure of these pages are generally consistent and should be something like:
- Installation
- Configuring Grafana
- Verifying the integration
etc...
If you're looking to write a tutorial, you can also create them for https://posthog.com/tutorials separately, there we'd expect a structure more similar to this. We can also create a more concrete example there.
- Drop the Objective / "Why is this useful?" boilerplate; the intro paragraph is now the lede - Replace tutorial-style "Step-by-step instructions" wrapper with flat reference sections (Configuring Grafana, Verifying the integration) - Use app.posthog.com signup link without the Cloud/self-hosted qualifier - Remove self-hosted PostHog FAQ entry; self-hosted guidance lives in the self-hosted docs Generated-By: PostHog Code Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286
- Rephrase the intro to avoid the lowercase "logs" product-name flag - Rename the FAQ heading to "Frequently asked questions" for sentence case Generated-By: PostHog Code Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286
gewenyu99
left a comment
There was a problem hiding this comment.
LGTM. Remember to rerequest review from Rafa since he requested changes
Changes
Grafana 13.1 added PostHog as an analytics destination for its echo service (grafana/grafana#122263, contributed by @rafaeelaudibert). Setting
posthog_token(and optionallyposthog_host) in the[analytics]section ofgrafana.iniforwards all of Grafana's frontend usage events — pageviews, UI interactions, experiment views, performance metrics, and frontend errors — to PostHog.This PR documents the integration:
contents/docs/libraries/grafana.md(→/docs/libraries/grafana), structured as reference material per the/docs/librariesconvention: intro, prerequisites (Grafana v13.1+),grafana.iniand env-var configuration, verification steps, a table mapping Grafana echo event types to PostHog events,identifybehavior, and FAQs.src/navs/index.jsunder SDKs → Services, in alphabetical order.src/constants/logos.tsand wired up viaplatformLogofrontmatter.Review feedback addressed
app.posthog.cominstead of hardcodedus.posthog.com(@rafaeelaudibert)grafanain thehttps://grafana.com/link URL, which can't be capitalizedNotes
🤖 Generated with Claude Code