feat(telemetry): adopt shared PostHog schema v2 (server events, features, flush)#96
Merged
Merged
Conversation
…res, flush)
- Upgrade posthog-telemetry submodule to the v2.0.0 API (SetProduct,
CaptureFeature, AssociateGroup, CaptureError, Flush)
- Emit against the shared DataZoo schema: product=flapi, install_kind="server",
one $session_id per uptime, deployment group at boot (optional account group
via FLAPI_LICENSE_ID)
- server_started{endpoint_count, auth_kind}; one rest_endpoint_served per
request {method, route_template, status_class, duration_ms, cache_hit};
mcp_tool_called{tool, status_class, duration_ms}; auth_enforced{auth_kind,
outcome}; $exception with enumerated error_class
- Route TEMPLATE only (never the filled path); bounded enum/number props only —
never URL/query/body/headers/SQL (verified by a real-transport no-leak test)
- Flush() on SIGINT/SIGTERM and clean exit; single opt-out via --no-telemetry /
FLAPI_NO_TELEMETRY / DATAZOO_DISABLE_TELEMETRY / telemetry.enabled:false;
optional telemetry.sample_rate for high-QPS deployments
- Add TELEMETRY.md documenting exactly what is collected
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
Upgrades flapi onto the shared DataZoo telemetry schema (
telemetry_schema: 2). flapi is a long-running server, soinstall_kind="server"and one$session_idper uptime.posthog-telemetrysubmodule to the v2.0.0 API (SetProduct,CaptureFeature,AssociateGroup,CaptureError,Flush).SetProduct("flapi", …),install_kind="server",deploymentgroup (optionalaccountviaFLAPI_LICENSE_ID), andserver_started{endpoint_count, auth_kind}(counts/kinds only).rest_endpoint_served{method, route_template, status_class, duration_ms, cache_hit}at the single REST choke point;mcp_tool_called{tool, status_class, duration_ms};auth_enforced{auth_kind, outcome};$exceptionwith an enumeratederror_class.Flush()on SIGINT/SIGTERM and clean exit (the library's at-exit handler discards by design). Single opt-out via--no-telemetry/FLAPI_NO_TELEMETRY/DATAZOO_DISABLE_TELEMETRY/telemetry.enabled: false; optionaltelemetry.sample_ratefor high-QPS.TELEMETRY.mdlisting exactly what is collected.cache_hitreports whether the endpoint is cache-backed (flapi has no per-request hit/miss signal — documented in TELEMETRY.md).Test plan
flapi-lib+ tests link against the upgraded lib.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.