Skip to content

Add query command for running ad-hoc queries#16

Closed
maragubot wants to merge 6 commits into
mainfrom
issue-7-queries
Closed

Add query command for running ad-hoc queries#16
maragubot wants to merge 6 commits into
mainfrom
issue-7-queries

Conversation

@maragubot

Copy link
Copy Markdown
Collaborator

Summary

  • Add query spec types and full query lifecycle API methods (create -> execute -> poll)
  • Add query command with flags for calculations, breakdowns, filters, and time range
  • Parse calculation strings like COUNT, AVG:duration_ms, P99:latency
  • Parse filter strings like status_code = 200, name contains foo
  • Table and JSON output formatting

This is the highest-value CLI feature, enabling ad-hoc querying from the terminal.

Test plan

  • CreateQuery, CreateQueryResult, GetQueryResult API methods tested
  • RunQuery full lifecycle tested (create -> execute -> poll with retries)
  • Calculation string parsing tested (COUNT, AVG, P99, etc.)
  • Filter string parsing tested (=, !=, >, contains, etc.)
  • Query command table and JSON output tested
  • No results case handled
  • go install . works

Closes #7

- Update module path to github.com/maragudk/honeycomb-cli
- Add cobra CLI framework with root command and global flags
- Support --api-key/HONEYCOMB_API_KEY and --api-url/HONEYCOMB_API_URL
- Add version command (set via -ldflags at build time)
- Add basic test for Execute function
- Update README with install and usage instructions

Closes #1
- Create honeycomb package with HTTP client supporting API key auth
- Add error response parsing (RFC 7807 Problem Detail format)
- Implement GET /1/auth endpoint for key verification
- Add `auth` command showing team, environment, and permissions
- Refactor commands to use NewRootCommand() for testability
- Add tests for client, auth API, and auth command

Closes #2
Closes #3
- Add Dataset types and API methods to honeycomb package
- Add datasets subcommands with table and JSON output
- Add newClient helper for creating API clients from flags
- Tests for all API methods and commands

Closes #4
- Add Marker types and API methods for list, create, delete
- Support --dataset flag (defaults to __all__ for environment-wide)
- Markers are useful for annotating deploys in CI/CD pipelines
- Table and JSON output formatting
- Tests for all API methods and commands

Closes #5
- Add Column types and ListColumns API method
- Add columns list command with --dataset flag (required)
- Table and JSON output formatting
- Tests for API method and command

Closes #6
- Add query spec types, create/execute/poll API methods
- Add RunQuery convenience method that handles full query lifecycle
- Add query command with --calculation, --breakdown, --filter, --time-range flags
- Support multiple calculations (e.g. COUNT, AVG:column, P99:column)
- Support filter parsing (e.g. "status_code = 200")
- Table and JSON output formatting
- Tests for API methods, calculation/filter parsing, and command output

Closes #7
@maragubot
maragubot enabled auto-merge (squash) February 27, 2026 12:44
@maragubot

Copy link
Copy Markdown
Collaborator Author

Changes included in PR #18

@maragubot maragubot closed this Feb 27, 2026
auto-merge was automatically disabled February 27, 2026 12:50

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query commands: create and run queries

1 participant