qbee-agent icon indicating copy to clipboard operation
qbee-agent copied to clipboard

Add report command to send arbitrary reports from agent

Open Copilot opened this issue 4 months ago • 3 comments

This PR adds a new report command line argument that allows sending arbitrary reports from the qbee agent to the backend system.

New Command Usage

# Send a report with all parameters
qbee-agent report --severity INFO --text "System startup completed" --bundle "system-monitor" --labels "startup,system"

# Using short flags
qbee-agent report -s WARN -t "Disk usage approaching limit" -b "disk-monitor" -l "warning,disk"

# Without optional labels
qbee-agent report --severity ERR --text "Database connection failed" --bundle "db-monitor"

Command Flags

  • --severity, -s (required): Report severity level - accepts INFO, WARN, ERR, or CRIT
  • --text, -t (required): Text summary of the report
  • --bundle, -b (required): Bundle name associated with the report
  • --labels, -l (optional): Comma-separated labels for categorization

Implementation Details

The implementation leverages existing report infrastructure:

  • Reuses the existing Report struct from app/configuration/report.go
  • Utilizes the existing /v1/org/device/auth/report API endpoint
  • Follows the same command pattern as other agent commands

Changes Made

  • New: app/cmd/report.go - Complete report command implementation with validation
  • Modified: app/cmd/main.go - Register the new report command
  • Modified: app/configuration/service.go - Add public SendReport method to expose existing functionality

The implementation includes proper validation for required flags and severity values, with clear error messages for invalid input.

Fixes #98.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Aug 08 '25 09:08 Copilot