Add anonymous telemetry heartbeat with PostHog#485
Merged
Conversation
Collaborator
|
/retest |
There was a problem hiding this comment.
4 issues found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/telemetry/telemetry_test.go">
<violation number="1" location="internal/telemetry/telemetry_test.go:232">
P2: Bug: `t.Fatalf` called from httptest handler goroutine. `t.Fatal`/`t.Fatalf` must only be called from the goroutine running the test. In HTTP handlers spawned by `httptest.NewServer`, use `t.Errorf` instead, or capture the error and assert it in the test goroutine.</violation>
</file>
<file name="internal/telemetry/telemetry.go">
<violation number="1" location="internal/telemetry/telemetry.go:226">
P2: The error response body is discarded, making it hard to debug telemetry send failures. Read and include the response body in the error message, and drain it on the success path for proper connection cleanup.</violation>
</file>
<file name="internal/manifests/install.yaml">
<violation number="1" location="internal/manifests/install.yaml:312">
P2: The Job template is missing `activeDeadlineSeconds`. Without it, if the telemetry collection or HTTP send hangs (e.g., API server degradation, DNS issues), the job has no upper time bound and will keep retrying up to `backoffLimit` with no per-attempt or total deadline. Consider adding `activeDeadlineSeconds: 300` (or similar) to the `jobTemplate.spec` to ensure the job is terminated if it runs too long.</violation>
</file>
<file name="cmd/kelos-controller/main.go">
<violation number="1" location="cmd/kelos-controller/main.go:97">
P2: The one-shot telemetry context has no timeout. If the Kubernetes API server is slow or unresponsive, the process could hang indefinitely. Add a context with a deadline (e.g., 2 minutes) to bound the total runtime of the telemetry report.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
b4f8352 to
30f384c
Compare
c68520b to
7073e2c
Compare
Collect anonymous, aggregate usage data (task counts, feature adoption, scale metrics) via a daily CronJob and send it to PostHog. No personal data is collected. - Add telemetry package with collection, PostHog sending, and installation ID persistence - Add --telemetry-report, --telemetry-endpoint, and --telemetry-environment flags to the controller - Add --disable-heartbeat flag to kelos install to opt out - Disable heartbeat in e2e CI - Add telemetry documentation to docs/reference.md
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
internal/telemetrypackage that collects anonymous aggregate data (task counts, feature adoption, scale metrics, token/cost usage) and sends it to PostHog--telemetry-report,--telemetry-endpoint, and--telemetry-environmentflags to the controller--disable-heartbeatflag tokelos installfor opt-outdocs/reference.mdData collected
All data is anonymous aggregates — no PII, repo URLs, prompts, or secrets:
production,development)Opting out
Test plan
make verifypassesmake testpasses — unit tests covering collection, sending, installation ID management, error handling,--disable-heartbeatflag, and CronJob filteringCloses #390
🤖 Generated with Claude Code