Skip to content

docs: add Python process CPU and memory metrics guide - #21224

Closed
marandaneto wants to merge 1 commit into
masterfrom
docs/python-cpu-memory-metrics
Closed

marandaneto wants to merge 1 commit into
masterfrom
docs/python-cpu-memory-metrics

Conversation

@marandaneto

Copy link
Copy Markdown
Member

Summary

Document how to collect Python process CPU and memory metrics with psutil and OpenTelemetry. The SDK and OTLP exporter do not collect these measurements automatically.

Changes

  • Add a runnable example that exports CPU percentage and resident memory every 15 seconds.
  • Explain measurement units, process limits, worker setup, and chart settings.
  • Link the example from the metrics overview.

Validation

  • Ran pnpm format. The repository excludes Markdown and MDX from Prettier. No unrelated formatting changes are included.
  • Ran Markdown lint on both changed files with zero errors.
  • Ran the documented example against a local OTLP receiver with idle and busy processes. Checked gauge values, units, worker identity, periodic exports, and the final export at shutdown.
  • Started pnpm start and loaded /docs/metrics and /docs/metrics/installation/python. Both returned HTTP 200 with no uncaught page errors. Console checks found no new errors compared with master.
  • Skipped autoreview because this PR changes documentation only.
  • No navigation, page moves, redirects, or UI components changed.

Checklist

  • I've read the docs and/or content style guides.
  • Words are spelled using American English
  • Use relative URLs for internal links
  • I've checked the pages added or changed in the Vercel preview build
  • If I moved a page, I added a redirect in vercel.json (not applicable)

@github-actions github-actions Bot added docs Improvements or additions to product documentation, "Docs" content PR only touches files under contents/ labels Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview

Status Details Updated (UTC)
🟢 Ready View preview Oct 14, 2026 11:09PM

Changed pages

Page Source
Application metrics contents/docs/metrics/index.mdx
Python metrics installation contents/docs/metrics/installation/python.mdx

@github-actions

Copy link
Copy Markdown
Contributor

Vale prose linter → found 4 errors, 24 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!

contents/docs/metrics/index.mdx — 3 errors, 18 warnings, 0 suggestions
Line Severity Message Rule
11:180 warning Capitalize 'Logs' for PostHog's product. Use 'logs' for the general industry concept. PostHogBase.ProductNames
13:113 error Hi, Andy here... use an en dash ( – ) with spaces. On Mac, holding down the Option and hyphen key will give you an en dash. PostHogBase.EnDash
17:73 error Hi, Andy here... use an en dash ( – ) with spaces. On Mac, holding down the Option and hyphen key will give you an en dash. PostHogBase.EnDash
27:206 warning Capitalize 'Endpoints' for PostHog's product. Use 'endpoints' for the general industry concept. PostHogBase.ProductNames
29:4 warning 'Already have PostHog installed? Use posthog.metrics' heading should be in sentence case, and product names should be capitalized. PostHogBase.SentenceCase
29:40 warning Use 'PostHog' instead of 'posthog'. Vale.Terms
31:5 warning Use 'PostHog' instead of 'posthog'. Vale.Terms
31:190 warning Use 'project token' instead of 'project API key'. The project token (phc_) is not an API key. PostHogBase.ProjectToken
44:91 warning Avoid trivializing words. 'easy to' can sound dismissive to the reader. PostHogDocs.Trivializers
68:48 warning Use 'PostHog' instead of 'posthog'. Vale.Terms
70:4 warning 'Set up metrics with OpenTelemetry' heading should be in sentence case, and product names should be capitalized. PostHogBase.SentenceCase
80:5 warning '2. Point your OTLP metrics exporter at PostHog' heading should be in sentence case, and product names should be capitalized. PostHogBase.SentenceCase
130:159 warning 'psutil' is a possible misspelling. PostHogBase.Spelling
166:5 warning 'Already running an OpenTelemetry Collector?' heading should be in sentence case, and product names should be capitalized. PostHogBase.SentenceCase
186:47 warning Capitalize 'Endpoints' for PostHog's product. Use 'endpoints' for the general industry concept. PostHogBase.ProductNames
186:300 warning Capitalize 'Endpoints' for PostHog's product. Use 'endpoints' for the general industry concept. PostHogBase.ProductNames
205:30 warning 'quantiles' is a possible misspelling. PostHogBase.Spelling
224:120 error Hi, Andy here... use an en dash ( – ) with spaces. On Mac, holding down the Option and hyphen key will give you an en dash. PostHogBase.EnDash
224:259 warning Use the Oxford comma before 'and' or 'or' in a list of three or more items. PostHogBase.OxfordComma
224:359 warning Capitalize 'Logs' for PostHog's product. Use 'logs' for the general industry concept. PostHogBase.ProductNames
239:6 warning Capitalize 'Error Tracking' for PostHog's product. Use 'Error tracking' for the general industry concept. PostHogBase.ProductNames
contents/docs/metrics/installation/python.mdx — 1 errors, 6 warnings, 0 suggestions
Line Severity Message Rule
10:63 error Hi, Andy here... use an en dash ( – ) with spaces. On Mac, holding down the Option and hyphen key will give you an en dash. PostHogBase.EnDash
12:6 warning Use 'PostHog' instead of 'posthog'. Vale.Terms
12:156 warning Capitalize 'Feature Flags' for PostHog's product. Use 'feature flags' for the general industry concept. PostHogBase.ProductNames
14:77 warning 'psutil' is a possible misspelling. PostHogBase.Spelling
30:59 warning Avoid trivializing words. 'easy to' can sound dismissive to the reader. PostHogDocs.Trivializers
101:6 warning 'psutil' is a possible misspelling. PostHogBase.Spelling
175:34 warning 'Gunicorn' is a possible misspelling. PostHogBase.Spelling

@github-actions

Copy link
Copy Markdown
Contributor

Bundle report

Total JS (gzip)

10.19 MiB (no change)

Eager graph (modules shipped in each entrypoint's initial chunks)

Entrypoint Eager size Budget Modules
✅ app 19.83 MiB (no change) report-only 2096
Largest modules in the app closure
Module Size
./src/data/mcp-tools.json 1353.1 KiB
css ./node_modules/.pnpm/[email protected][email protected]/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[1]!./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[2]!./src/styles/global.css 813.3 KiB
./src/components/Stickers/Stickers.tsx 696.4 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js 481.4 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/x-ray.mjs 481.2 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/trenchcoat.mjs 450.8 KiB
./node_modules/.pnpm/[email protected]/node_modules/rehype-raw/lib/index.js + 29 modules 395.1 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/im-the-driver.mjs 385.8 KiB
./src/hooks/useCustomers.tsx + 59 modules 380.8 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/tourist.mjs 364.6 KiB
./node_modules/.pnpm/@[email protected][email protected][email protected][email protected]/node_modules/@posthog/icons/dist/posthog-icons.es.js 354.8 KiB
./node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/react-markdown/lib/react-markdown.js + 88 modules 351.4 KiB
./src/components/ProductComparisonTable/index.tsx + 127 modules 310.3 KiB
./node_modules/.pnpm/@[email protected][email protected]/node_modules/@posthog/brand/dist/generated/hoggies/svg/doll-house.mjs 284.1 KiB
./node_modules/.pnpm/[email protected][email protected]/node_modules/cloudinary-core/cloudinary-core.js 281.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 for the modules actually shipped in the entrypoint's initial chunks (post-tree-shake).

@marandaneto
marandaneto requested review from a team and turnipdabeets October 15, 2026 15:04
@marandaneto
marandaneto marked this pull request as ready for review October 15, 2026 15:04
@marandaneto

Copy link
Copy Markdown
Member Author

PostHog/posthog-python#1063 should automate the process after tho, WIP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content PR only touches files under contents/ docs Improvements or additions to product documentation, "Docs"

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant