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.

1.5 KB
Raw Blame

Proto definitions

Adding or modifying RPCs

When you add or modify an RPC or message type in personhog/ protos, you must update all downstream consumers before considering the change complete:

1. Python generated stubs

bin/generate_personhog_proto.sh

Then update:

  • posthog/personhog_client/proto/__init__.py — add/remove re-exports for any new/removed message types
  • posthog/personhog_client/client.py — add/remove wrapper methods for any new/removed RPCs
  • posthog/personhog_client/fake_client.py — implement the new method for test use

2. Node.js generated stubs

cd nodejs && pnpm run generate:personhog-proto

Then update:

  • nodejs/src/common/personhog/client.test.ts — add a default stub to the SERVICE_DEFAULTS object for any new RPC

3. Rust

No codegen step needed (tonic regenerates on cargo build), but you must:

  • Implement the RPC in rust/personhog-replica/ (storage layer + service handler)
  • Add the method name to KNOWN_METHODS in rust/personhog-router/src/proxy.rs (the router forwards raw bytes; leader-routed methods are matched by name there)
  • Add tests (see Rust test conventions in rust/personhog-replica/AGENTS.md)

Ingestion worker protos

When you add or modify an RPC or message type in ingestion/ protos, regenerate the Node.js stubs and commit them (CI rejects stale stubs):

cd nodejs && pnpm run generate:ingestion-worker-proto

Rust bindings (rust/ingestion-worker-proto) regenerate on cargo build.