feat: add deployment_type property to all PostHog telemetry events#421
Open
feat: add deployment_type property to all PostHog telemetry events#421
Conversation
When a user exports a compiled graph (common in LangGraph tutorials), the engine now recovers gracefully instead of raising a TypeError. The CompiledStateGraph.builder attribute gives back the original StateGraph, which is then recompiled with the engine-managed checkpointer/store. - _validate_graph_builder: extract .builder from CompiledStateGraph and return the underlying StateGraph with a warning; raise TypeError only for genuinely unsupported types - initialize: drop the now-dead CompiledStateGraph branch (always receives a StateGraph after _validate_graph_builder) - Add unit test confirming compiled-graph input is accepted, the engine checkpointer is injected, and invoke() works end-to-end Closes #401 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All PostHog events now include a `deployment_type` super property that automatically distinguishes cloud deployments from self-hosted ones. Frontend: `src/utils/deployment.ts` detects cloud by matching the hostname `cloud.idunplatform.com`; everything else is `self-hosted`. The value is registered as a PostHog super property in `main.tsx` via `posthog.register()`, so no per-event instrumentation is needed. Backend: `IDUN_DEPLOYMENT_TYPE=cloud` env var tags engine telemetry events. Defaults to `self-hosted` when unset, so existing self-hosted deployments get the correct value without any configuration change. The cloud deployment sets this env var in its Docker environment. Also adds a unit test project to vite.config.ts so existing and new `.test.ts` files can be run with `vitest --project=unit`. Closes #334 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deployment_type: "cloud" | "self-hosted"to every PostHog event across the platform — zero per-event instrumentation requiredcloud.idunplatform.com→"cloud", everything else →"self-hosted"), registered as a PostHog super property viaposthog.register()inmain.tsxIDUN_DEPLOYMENT_TYPEenv var (default:"self-hosted"); cloud deployment setsIDUN_DEPLOYMENT_TYPE=cloudin its Docker environmentvite.config.tsso existing and new.test.tsfiles can run withvitest --project=unitCloses #334
Changes
src/utils/deployment.tsgetDeploymentType(hostname)— pure function, easily testablesrc/main.tsxDeploymentSuperPropertiescomponent callsposthog.register()once at startupsrc/utils/deployment.test.tsvite.config.tsunittest project with node environmenttelemetry/config.pyget_deployment_type(environ)— readsIDUN_DEPLOYMENT_TYPEenv vartelemetry/telemetry.py_common_properties()now includesdeployment_typetests/unit/telemetry/test_deployment_type.pyservices/idun_agent_web/CLAUDE.mdlibs/idun_agent_engine/CLAUDE.mdTest plan
vitest --project=unit— 12 frontend unit tests pass (8 new deployment tests)ruff check— no issues on modified Python filesdeployment_typeafter deployingFuture Improvements
These would make the analytics even more powerful for comparing cloud vs self-hosted usage:
Richer event context
library_versionalready on backend — surface it in frontend events too)agent_countas a super property (requires a quick API call on startup)workspace_countanduser_countto understand deployment scaleauth_mode(basicvsoidc) to segment by enterprise vs hobbyist usageSegmentation & funnels
Alerting & anomaly detection
Dashboard templates
Licence & plan segmentation
license_typeproperty once paid tiers are introduced (free / pro / enterprise)deployment_typefor a 2x2 analysis: cloud-free, cloud-paid, self-hosted-free, self-hosted-paidSelf-hosted telemetry health
IDUN_TELEMETRY_ENABLED=false) to understand what fraction of self-hosted installs are dark🤖 Generated with Claude Code