Repository navigation
feat(gitops): add read commands for app details, agent metrics and dashboard - #505
BlueLabelscotch wants to merge 4 commits into
Conversation
…gs, managed resources, resource actions, agent metrics and dashboard
|
CLI Grammar Review · session (Harness team members only) · fe0e7ca CLI grammar changes (beta) · Advisory only, FYI, not required changes.
Overall: 🟡 Recommend manual review |
| verb: get | ||
| noun: gitops_pod_log | ||
| short: "Get pod logs of an application: harness get gitops_pod_log <agent/app> [--pod-name ...]" | ||
| handler_type: endpoint |
There was a problem hiding this comment.
get gitops_pod_log uses the generic endpoint handler for the streaming PodLogs API. That handler reads the whole body and unmarshals it as one JSON value (pkg/client/client.go:268–291), so a successful response with multiple log entries fails as malformed API response before any output can be rendered.
Severity: high
🤖 Was this useful? React with 👍 or 👎
| item_expr: it | ||
| yaml_pick_expr: it | ||
| query_params: | ||
| podName: 'flags["pod-name"] != "" ? flags["pod-name"] : nil' |
There was a problem hiding this comment.
The PodLogs API reads query.podName, query.namespace, query.container, and query.tailLines, but get gitops_pod_log sends all four without the query. prefix. The request therefore does not bind the caller’s filters or tail limit, potentially selecting more logs than requested.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| noun: gitops_app_resource_tree | ||
| short: "Get the Kubernetes resource tree of an application: harness get gitops_app_resource_tree <agent/app>" | ||
| handler_type: endpoint | ||
| id_parts: 2 |
There was a problem hiding this comment.
get gitops_app_resource_tree cannot target applications stored as namespace/app: id_parts: 2 rejects agent/namespace/app, and the command does not expose the API’s separate application-namespace parameter. Other locations where this applies: pkg/spec/gitops.spec.yaml:1307, :1319, :1345, :1357.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| yaml_pick_expr: it | ||
|
|
||
| - command: get gitops_app_event | ||
| verb: get |
There was a problem hiding this comment.
gitops_app_event takes an application ID and returns zero or more events, not one named event, so verb: get conflicts with the get/list cardinality rule in AGENTS.md and docs/verbs.md. Other locations where this applies: pkg/spec/gitops.spec.yaml:1341 (gitops_managed_resource), :1353 (gitops_resource_action).
Severity: low
🤖 Was this useful? React with 👍 or 👎
…st events, resources and actions
|
cosmos review |
| return nil, fmt.Errorf("range is over 14 days (the metrics retention window); use a shorter range") | ||
| } | ||
| return map[string]string{ | ||
| "startTime": start.UTC().Format(time.RFC3339), |
There was a problem hiding this comment.
metricsRangeParams validates timestamps with fractional seconds but drops the fraction when building startTime and endTime. A valid range entirely within one second is sent as two identical timestamps, so the API does not receive the window the CLI validated.
Severity: medium
🤖 Was this useful? React with 👍 or 👎
| - id: count | ||
| expr: it.count | ||
| - id: last_seen | ||
| expr: it.lastTimestamp |
There was a problem hiding this comment.
gitops_event.last_seen reads only the legacy lastTimestamp field, so events that report their observation time through series.lastObservedTime or eventTime can show a blank last_seen even though the API response includes the time.
Severity: low
🤖 Was this useful? React with 👍 or 👎
Adds read-only GitOps commands:
get gitops_app_resource_tree,gitops_app_event,gitops_pod_log,gitops_managed_resource,gitops_resource_actiontake<agent>/<app>get gitops_agent_metrics <agent> --start-time --end-time [--source], which rejects a start after the end or a range over 14 days (the API silently returns an empty result for both)get gitops_dashboardOnly
gitops_dashboardwas checked against real data. The other commands reach the right endpoints, but every agent in my test project is disconnected, so they only returned "Agent is disconnected". Their output is the raw response (--format jsonor--yaml), not tuned fields.gitops_cluster_linkand the write commands are not included.