feat(scanner): compute and render per-scanner duration_ms#667
Merged
Conversation
The scan report carried per-scanner started_at/completed_at but no duration, and the CLI rendered no per-scanner timing. Add a derived duration_ms to each scanner status and surface it in the CLI: - ScannerJobStatus gains a duration_ms field and a Duration() helper; the engine recomputes it once both timestamps are known (the live scan path sets start and completion in separate updates). - security status grows a DURATION column. - security report renders a per-scanner "Scanner timing" block. - CLI reads duration_ms, falling back to started_at/completed_at for reports produced before the field existed. Related to MCP-2402
Deploying mcpproxy-docs with
|
| Latest commit: |
f701b8f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5a8484f9.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://mcp-2402-scanner-duration-ms.mcpproxy-docs.pages.dev |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 27501692667 --repo smart-mcp-proxy/mcpproxy-go
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The scan report JSON carried per-scanner
started_at/completed_atbut noduration_ms, and the CLI rendered no per-scanner timing at all. This adds aderived per-scanner duration and surfaces it in the CLI.
Changes
internal/security/scanner/types.go—ScannerJobStatusgains aduration_msJSON field and aDuration()helper that returns 0 for thedegenerate cases (still running, never started, clock skew).
internal/security/scanner/engine.go—updateScannerStatusrecomputesDurationMsonce both timestamps are known. The live scan path setsStartedAtandCompletedAtin separate calls, so the duration is derivedfrom the stored
StartedAtwhenCompletedAtarrives.cmd/mcpproxy/security_cmd.gosecurity statusper-scanner table gains a DURATION column.security reportrenders a per-scanner "Scanner timing" block.duration_ms, falling back to computing fromstarted_at/completed_atfor reports produced before the field existed.docs/cli/security-commands.md— updated status/report examples anddocumented the new
scanner_statuses[].duration_msfield.Testing
TDD: tests written first (red), then implementation (green).
internal/security/scanner:TestScannerJobStatusDuration,TestUpdateScannerStatusComputesDurationMscmd/mcpproxy:TestFormatScannerDurationMs,TestScannerDurationMs,TestPrintScannerStatusTableRendersDuration,TestPrintReportTableRendersScannerTimingsVerified locally:
go test ./internal/security/... ./cmd/mcpproxy/ -race— passgo test ./internal/httpapi/ -run Scan— passgolangci-lint v2 run --config .github/.golangci.yml(changed pkgs) — 0 issuesRelated to MCP-2402