Skip to content

Conversation

@carlos-gn
Copy link
Contributor

Summary

  • Add new thv status <workload-name> command to display detailed workload information
  • Display name, status, health context, uptime, group, transport, URL, port, PID, CPU usage, and memory usage
  • Support both text (key-value) and JSON output formats via --format flag
  • Add GetWorkloadStats to Runtime interface for CPU/memory metrics from container runtime
  • Add StartedAt and ProcessID fields to core.Workload for uptime and PID tracking

Test plan

  • Unit tests for text and JSON output formatting
  • Unit tests for Docker stats retrieval with edge cases (zero CPU delta, zero system delta, multiple CPUs)
  • E2E tests for status command workflow (run → status → verify)
  • All existing tests pass

Closes #3053

Implement a new status command that displays comprehensive information
about a specific MCP server workload, including resource usage metrics.

Features:
- Display workload details: name, status, health context, uptime, group,
  transport, URL, port, PID, CPU usage, and memory usage
- Support both text (key-value) and JSON output formats (--format flag)
- Add GetWorkloadStats to Runtime interface for CPU/memory metrics
- Add StartedAt and ProcessID fields to core.Workload for uptime/PID tracking

Components affected:
- cmd/thv/app: New status command and tests
- pkg/container/docker: GetWorkloadStats implementation with CPU calculation
- pkg/container/kubernetes: GetWorkloadStats stub
- pkg/container/runtime: WorkloadStats struct and interface updates
- pkg/core: Workload struct extended with StartedAt, ProcessID
- pkg/workloads: Manager interface and file_status updates
- test/e2e: Status command integration tests

Closes stacklok#3053

Signed-off-by: carlos <21148423+carlos-gn@users.noreply.github.com>
@github-actions github-actions bot added the size/L Large PR: 600-999 lines changed label Dec 26, 2025
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 26, 2025
@codecov
Copy link

codecov bot commented Dec 26, 2025

Codecov Report

❌ Patch coverage is 61.53846% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.08%. Comparing base (ab329ce) to head (c3e7e85).

Files with missing lines Patch % Lines
pkg/container/docker/client.go 71.42% 4 Missing and 4 partials ⚠️
pkg/container/kubernetes/client.go 0.00% 2 Missing ⚠️
pkg/workloads/manager.go 0.00% 2 Missing ⚠️
pkg/workloads/statuses/file_status.go 66.66% 0 Missing and 2 partials ⚠️
pkg/workloads/types/types.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3161   +/-   ##
=======================================
  Coverage   57.07%   57.08%           
=======================================
  Files         348      348           
  Lines       34608    34641   +33     
=======================================
+ Hits        19753    19775   +22     
- Misses      13207    13218   +11     
  Partials     1648     1648           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 26, 2025
Signed-off-by: carlos <21148423+carlos-gn@users.noreply.github.com>
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/L Large PR: 600-999 lines changed labels Dec 26, 2025
@eleftherias eleftherias requested a review from dmjb January 5, 2026 14:07
@carlos-gn carlos-gn force-pushed the feat/status-command branch from f1c30dd to c1fad6e Compare January 7, 2026 23:48
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/L Large PR: 600-999 lines changed labels Jan 7, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification

[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

@carlos-gn carlos-gn force-pushed the feat/status-command branch from c1fad6e to d869b45 Compare January 7, 2026 23:52
@github-actions github-actions bot added size/L Large PR: 600-999 lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large PR: 600-999 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement thv status command for detailed workload status

1 participant