feat(gateway): add metrics query commands (Phase 5a-E)#222
Merged
Conversation
Previously, pagination cursors (next/prev) were not displayed to users in CLI output, even though they were available in the API responses. This made it impossible to paginate through large result sets. Changes: - Created pkg/cmd/pagination_output.go with helper functions: - printPaginationInfo() for text output - marshalListResponseWithPagination() for JSON output - Updated all 8 list commands to display pagination info: - event list - request list - attempt list - transformation list - transformation executions - connection list - source list - destination list - Fixed JSON output to always include pagination metadata (previously returned [] for empty results) - Updated test helper functions to handle new JSON response format - Added comprehensive pagination acceptance tests for: - event list (TestEventListPaginationWorkflow) - request list (TestRequestListPaginationWorkflow) - attempt list (TestAttemptListPaginationWorkflow) - Updated TestEventListJSON to verify pagination metadata Fixes #216
- Add pkg/hookdeck/metrics.go: 7 API methods, MetricsQueryParams, response parsing - Add gateway metrics command group with shared flags (--start, --end, --granularity, --measures, --dimensions, filters) - Add 7 subcommands: events, requests, attempts, queue-depth, pending, events-by-issue, transformations - events-by-issue takes <issue-id> as positional argument; other commands use optional filter flags - Add test/acceptance/metrics_test.go: help, baseline, common flags, validation, JSON output (~27 tests) - Update REFERENCE.md with metrics use-case table and examples Implements Phase 5a-E metrics plan. API requires date range and measures; events-by-issue requires issue ID. Made-with: Cursor
Use ShortBeta and LongBeta on all 7 metrics subcommands so help text shows [BETA] and feedback link, consistent with other gateway commands. Made-with: Cursor
Fixes in tools/generate-reference/main.go for correct generation of CLI metrics docs (e.g. usage line escaping, table formatting). No CLI binary change; docs generator only. Made-with: Cursor
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
Adds
hookdeck gateway metricswith 7 subcommands for querying Event Gateway metrics (events, requests, attempts, queue-depth, pending, events-by-issue, transformations).Changes
pkg/hookdeck/metrics.go): 7 methods, sharedMetricsQueryParams, response parsing (including transformations{ data: [] }wrapper).pkg/cmd/metrics.go):gateway metricswith common flags--start,--end(required),--granularity,--measures,--dimensions,--source-id,--destination-id,--connection-id,--status,--output.metrics_events.go,metrics_requests.go,metrics_attempts.go,metrics_queue_depth.go,metrics_pending.go,metrics_events_by_issue.go,metrics_transformations.go.<issue-id>as positional argument (no--issue-idflag) for consistency with other resource-id-as-argument commands.test/acceptance/metrics_test.go— help, 7 baseline, common-flag, validation (missing --start/--end/--measures, missing issue-id for events-by-issue), and JSON output (~27 tests). All passing.Plan
Implements Phase 5a-E (metrics querying) from the CLI updates plan. API requires
date_rangeandmeasures; events-by-issue requires issue ID (CLI: positional<issue-id>).Made with Cursor