-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add more posthog analytics (privacy aware) #6122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| #[utoipa::path( | ||
| post, | ||
| path = "/telemetry/event", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok - as it means we could in theory swap out what is at the backend from posthog
crates/goose/src/posthog.rs
Outdated
| #[derive(Debug, Clone)] | ||
| pub enum SlashCommandType { | ||
| /// Builtin command (e.g., /compact) - name is safe to track | ||
| Builtin(String), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come we want to track slash commands? will this be the same from GUI vs CLI? (I didn't realise they were that heavily used - but I guess idea is to track it? not sure why but seems fairly fine grained but I guess there is no info in it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah just to see how much its used, then again maybe we don't need the fine grain just general usage on non built ins would be enough, will follow up with that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed built in tracking logic
| import cronstrue from 'cronstrue'; | ||
| import { formatToLocalDateWithTimezone } from '../../utils/date'; | ||
| import { getSession, Session } from '../../api'; | ||
| import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with recipes and schedule tracking - do we want to track it this fine grained vs just seeing if people use either feature in some meaningful way? (maybe need to do this but seems like a lot!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hard to say the point is to see what fine grained features are really needed cluttering up our ui... will take another look and see if can be pruned more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call removed some low value fine-grained tracking for these scheduling features but I think the recipe ones are valid to get an idea if they are even used
trackScheduleUpdated - editing schedules
trackSchedulePaused / trackScheduleUnpaused - pause toggle
trackScheduleKilled - killing running jobs
trackScheduleInspected - inspecting running jobs
trackScheduleViewed - viewing schedule details
|
|
||
| const App = lazy(() => import('./App')); | ||
|
|
||
| const TELEMETRY_CONFIG_KEY = 'GOOSE_TELEMETRY_ENABLED'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have thought the backend would take care of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it does also but the frontend needs to check the config also so it can avoid sending all the events for no reason if it is disabled
|
I think looks ok - is a lot of extra stuff, just had some Qs if we realy want schedules/recipes that fine grained (I guess idea is to know if used or not) but seems ok |
michaelneale
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving to not block this if we need more insight to know what is used
|
@michaelneale thanks valid concerns, removed a few low signal ones. Will leave this open for a bit longer in case anyone has other feedback. |
* 'main' of github.com:block/goose: (22 commits) OpenRouter & Xai streaming (#5873) fix: resolve mcp-hermit cleanup path expansion issue (#5953) feat: add goose PR reviewer workflow (#6124) perf: Avoid repeated MCP queries during streaming responses (#6138) Fix YAML serialization for recipes with special characters (#5796) Add more posthog analytics (privacy aware) (#6122) docs: add Sugar MCP server to extensions registry (#6077) Fix tokenState loading on new sessions (#6129) bump bedrock dep versions (#6090) Don't persist ephemeral extensions when resuming sessions (#5974) chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /ui/desktop (#5939) chore(deps): bump node-forge from 1.3.1 to 1.3.2 in /documentation (#5898) Add Scorecard supply-chain security workflow (#5810) Don't show subagent tool when we're a subagent (#6125) Fix keyboard shortcut conflict for Focus Goose Window (#5809) feat(goose-cli): add feature to disable update (#5886) workflow: enable docs-update-recipe-ref (#6132) fix: filter tools in Ollama streaming when chat mode is enabled (#6118) feat(mcp): platform extension for "code mode" MCP tool calling (#6030) workflow: auto-update recipe-reference on release (#5988) ... # Conflicts: # ui/desktop/src/App.tsx # ui/desktop/src/api/sdk.gen.ts # ui/desktop/src/components/ChatInput.tsx # ui/desktop/src/components/recipes/RecipesView.tsx
…s-predefined-models * 'main' of github.com:block/goose: (81 commits) fix: display shell output as static text instead of spinner (#6041) fix : Custom providers with empty API keys show as configured in desktop (#6105) Add .agents/skills and ~/.config/agent/skills to skills discovery paths (#6139) fix: use instructions for system prompt and prompt for user message in subagents (#6121) Fix compaction loop for small models or large input (#5803) feat: Centralize theme management with ThemeContext (#6137) OpenRouter & Xai streaming (#5873) fix: resolve mcp-hermit cleanup path expansion issue (#5953) feat: add goose PR reviewer workflow (#6124) perf: Avoid repeated MCP queries during streaming responses (#6138) Fix YAML serialization for recipes with special characters (#5796) Add more posthog analytics (privacy aware) (#6122) docs: add Sugar MCP server to extensions registry (#6077) Fix tokenState loading on new sessions (#6129) bump bedrock dep versions (#6090) Don't persist ephemeral extensions when resuming sessions (#5974) chore(deps): bump mdast-util-to-hast from 13.2.0 to 13.2.1 in /ui/desktop (#5939) chore(deps): bump node-forge from 1.3.1 to 1.3.2 in /documentation (#5898) Add Scorecard supply-chain security workflow (#5810) Don't show subagent tool when we're a subagent (#6125) ... # Conflicts: # crates/goose/src/providers/formats/databricks.rs
* main: fix: we don't need to warn about tool count when in code mode (#6149) deps: upgrade agent-client-protocol to 0.9.0 (#6109) fix(providers): fix for gemini-cli on windows to work around cmd's multiline prompt limitations #5911 (#5966) More slash commands (#5858) fix: MCP UI not rendering due to CallToolResult structure change (#6143) fix: display shell output as static text instead of spinner (#6041) fix : Custom providers with empty API keys show as configured in desktop (#6105) Add .agents/skills and ~/.config/agent/skills to skills discovery paths (#6139) fix: use instructions for system prompt and prompt for user message in subagents (#6121) Fix compaction loop for small models or large input (#5803) feat: Centralize theme management with ThemeContext (#6137) OpenRouter & Xai streaming (#5873) fix: resolve mcp-hermit cleanup path expansion issue (#5953) feat: add goose PR reviewer workflow (#6124) perf: Avoid repeated MCP queries during streaming responses (#6138) Fix YAML serialization for recipes with special characters (#5796) Add more posthog analytics (privacy aware) (#6122) docs: add Sugar MCP server to extensions registry (#6077)
* origin/main: (57 commits) docs: create/edit recipe button (#6145) fix(google): Fix 400 Bad Request error with Gemini 3 thought signatures (#6035) fix: we don't need to warn about tool count when in code mode (#6149) deps: upgrade agent-client-protocol to 0.9.0 (#6109) fix(providers): fix for gemini-cli on windows to work around cmd's multiline prompt limitations #5911 (#5966) More slash commands (#5858) fix: MCP UI not rendering due to CallToolResult structure change (#6143) fix: display shell output as static text instead of spinner (#6041) fix : Custom providers with empty API keys show as configured in desktop (#6105) Add .agents/skills and ~/.config/agent/skills to skills discovery paths (#6139) fix: use instructions for system prompt and prompt for user message in subagents (#6121) Fix compaction loop for small models or large input (#5803) feat: Centralize theme management with ThemeContext (#6137) OpenRouter & Xai streaming (#5873) fix: resolve mcp-hermit cleanup path expansion issue (#5953) feat: add goose PR reviewer workflow (#6124) perf: Avoid repeated MCP queries during streaming responses (#6138) Fix YAML serialization for recipes with special characters (#5796) Add more posthog analytics (privacy aware) (#6122) docs: add Sugar MCP server to extensions registry (#6077) ...
Summary
Expands analytics coverage across both the backend (Rust) and frontend (TypeScript) to provide better insights into feature usage and error patterns.
All frontend analytics are sent through a new endpoint and the existing posthog.rs api integration. I first attempted the posthog js library but it was having authentication issues and we reuse a lot of code anyway so might as well leave it in the backend for now.
Key Design Decisions
source: "backend"orsource: "frontend"for debugginggetErrorType()helper standardizes error classificationBackend Changes (Rust)
New Events
slash_command_used- Tracks slash command usage with:command_type: "builtin" | "recipe" | "unknown"command_name: Only for builtin commands (privacy-safe)success: true for valid commands, false for unknownschedule_job_started/schedule_job_completed- Tracks automated scheduled job execution with durationEnhanced
session_startedEventNow includes additional properties:
is_dev- Whether running in debug/dev modedb_schema_version- Current database schema versionsetting_mode,setting_max_turns,setting_router_enabled,setting_lead_model,setting_lead_provider,setting_lead_turns,setting_lead_failure_threshold,setting_lead_fallback_turnsEnhanced
errorEventerror_categoryclassificationsource: "backend"markerErrorContextstruct with optionalcomponentandactionfieldsNew Infrastructure
emit_event()- Generic event emitter for custom events with arbitrary propertiesemit_slash_command_used()- Dedicated slash command trackingemit_error_with_context()- Error tracking with additional context/telemetry/eventAPI endpoint for frontend-to-backend event forwardingFrontend Changes (TypeScript)
New Analytics Module (
utils/analytics.ts)Comprehensive type-safe analytics including:
Schedule Events:
schedule_created(with source_type: file/deeplink)schedule_updated,schedule_deleted,schedule_paused,schedule_unpausedschedule_run_now,schedule_killed,schedule_inspected,schedule_viewedRecipe Events:
recipe_created,recipe_imported,recipe_edited,recipe_deletedrecipe_started(with in_new_window flag)recipe_deeplink_copiedrecipe_scheduled,recipe_slash_command_set(with action: add/edit/remove)Extension Events:
extension_added,extension_enabled,extension_disabled,extension_deletedis_builtinflag;extension_nameonly tracked for builtin extensionsChat Input Bar Events:
input_file_attached(file/directory)input_voice_dictation(start/stop/transcribed/error with duration)input_mode_changed(from/to mode)input_diagnostics_opened,input_create_recipe_opened,input_edit_recipe_openedCore Events:
page_viewwith referrer trackingmodel_changed,settings_tab_viewed,setting_toggledtelemetry_preference_seterror_occurred,app_crashed,app_reloadedonboarding_started,onboarding_provider_selected,onboarding_completed,onboarding_abandoned,onboarding_setup_failedNew Hook (
hooks/useAnalytics.ts)usePageViewTracking()- Automatic page view tracking on route changesComponents Updated
SchedulesView.tsx- Schedule CRUD operationsScheduleDetailView.tsx- Schedule inspection/killRecipesView.tsx- Recipe managementChatInput.tsx- File attachments, voice dictation, mode changesBottomMenuModeSelection.tsx- Mode switchingextension-manager.ts- Extension lifecycleSettingsView.tsx,TelemetrySettings.tsx,SecurityToggle.tsx, etc. - Settings togglesErrorBoundary.tsx- Crash trackingProviderGuard.tsx- Provider setup trackingSwitchModelModal.tsx- Model changesApp.tsx/renderer.tsx- Global error handlers and page view tracking