feature(telemetry): Add Telemetry Reporting for Hooks#29
Open
rishiy15 wants to merge 3 commits into
Open
Conversation
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.
What's Changed
Adds opt-in telemetry for agent hook usage so we can understand adoption, plugin-vs-hooks usage, and hook outcomes across agentic IDEs. Events are written locally as JSONL into the 1Password app's hook-events directory and ingested out-of-band by the desktop app — the hook itself never makes network calls.
High-level summary
lib/telemetry.sh(new)write_execution_event,write_install_event), millisecond clock helper, bucketing, install-method detection, idempotent install sentinel, 1MB file cap.bin/run-hook.shagent_hook_executionevent per invocation, and emits a one-timeagent_hook_installevent per (client, hook, install_method) combo. All telemetry is wrapped in a fail-open subshell so the hook decision is never affected.hooks/1password-validate-mounted-env-files/hook.shmode,mount_count,deny_reason). Populatesresolved_mode, incrementstotal_mount_countper validated mount, and derivesdeny_reasonfrom the failure mode.install.shVERSIONinto the bundle and writes oneagent_hook_installevent per installed hook withinstall_method=install_script.lib/json.shextract_json_integerso the runner can pullmount_countout of canonical output.schemas/hook-output.schema.jsonmode,mount_count, anddeny_reasonproperties — strictly additive, existing hooks remain valid.VERSION(new)hook_versionin telemetry. Set to1.0.0.Telemetry event schemas
agent_hook_executionhook_name1password-validate-mounted-env-fileshook_versionmajor.minor.patchfromVERSIONclientcursor,claude-code,github-copilot,windsurf,unknownevent_typebefore_shell_executiondecisionallow,denydeny_reasonfile_missing,file_disabled, ornullduration_ms0-50,50-100,100-200,200-500,500-1000,1000-5000,5000+modeconfigured(explicit TOMLmount_paths) ordefault(auto-discovery)mount_countagent_hook_installclienthook_nameinstall_methodplugin_marketplace,install_script,unknownPrivacy & safety
~/.config/1Password/telemetry-enabledexists; the 1Password app creates this file based on the user's choice.|| true; any failure (permission, disk, parse) is silently swallowed and the hook decision proceeds normally.events.jsonl(~4100 events) before any append.install.sh).Testing Done
tests/lib/telemetry.bats(27 cases) covers bucketing, consent gating, JSONL writes, file-size cap, JSON shape of execution/install events, install sentinel idempotency, and install-method detection (CURSOR_PLUGIN_ROOT,CLAUDE_PLUGIN_ROOT, bundle-path marker, unknown).tests/lib/json.batswithextract_json_integercases.tests/hooks/1password-validate-mounted-env-files.batsto account for the extended canonical output.bats tests/adapters/*.bats tests/hooks/*.bats tests/install/*.bats tests/lib/*.bats).~/.config/1Password/data/hook-events/events.jsonl.