Add report command to send arbitrary reports from agent
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 - acceptsINFO,WARN,ERR, orCRIT -
--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
Reportstruct fromapp/configuration/report.go - Utilizes the existing
/v1/org/device/auth/reportAPI 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 publicSendReportmethod 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.
@jonhenrik13 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.
I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.
@copilot please implement the suggested changes
@copilot please implement the suggested changes
All suggested changes have been implemented in commit 1fa4d2c:
- Updated copyright year to 2025
- Added bundle name validation function
- Simplified error handling for SendReport