Repository navigation
Add per-tool latency and error-rate analytics - #1521
Conversation
|
👋 Welcome, @wunsir, and thanks for opening your first PR on AnythingMCP! A few quick pointers:
Someone from the core team will look at this within ~48h. If you don't hear back, please ping us in Discussions / Q&A. ⭐ While you wait — if you find AnythingMCP useful, a star helps others discover it. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
Thanks for picking up #984, @wunsir, and for the detailed write-up, including the test runs that did not pass. One thing blocks the merge: the CLA. Please post the comment the CLA bot asks for above ( CI: I approved the workflow runs, so Backend, Frontend, Playwright, CodeQL and Trivy are running now. The integration spec will run against the PostgreSQL service in CI. That covers the native run you could not do locally. The First read of the code:
I'll do the full review once CI is green and the CLA is signed. |
helpcodeai
left a comment
There was a problem hiding this comment.
Thanks, @wunsir. I see you had already signed the CLA a few minutes before my comment, sorry for the noise. The CLA check is green, and so is CI. tool-performance.integration.spec.ts ran and passed against the PostgreSQL service in CI, so the native run is covered.
I read the rest of the PR:
- Backend: the DTO bounds
hours,limitandoffset. Filters go throughPrisma.sql, so no value is concatenated into the SQL. The endpoint returns the sameerrortext members can already read in the audit log, so it exposes nothing new. - Frontend: a stale response cannot overwrite a newer selection, there is a retry on errors, and
lastErroris rendered as text. The translations indeanditread naturally. - Tests: the unit, integration and Playwright specs cover pagination, the filters, and isolation between organizations.
Approving. The one thing I'd still like is the Cloud/self-hosted line in the description. It's not a blocker. We'll merge it in the next batch.
|
Thanks for the review and approval! I've added the Cloud/self-hosted note to the PR description. Appreciate you taking the time to review the changes. |
|
Thanks @wunsir, merged. The tool performance view will be on AnythingMCP Cloud with today's deploy, and in the next self-hosted release. I checked the query plan on a large workspace: it uses the tool and date index, so a 90-day window stays fast. |
Summary
Adds a Tool performance table to Analytics to help identify slow or failing tools without querying the audit logs manually.
It shows call counts, error rates, p50/p95/p99 latency, and the latest recorded error, grouped by tool and MCP server. The table has its own time-range and connector/server filters, defaulting to the last 24 hours.
The existing Analytics overview and Top tools ranking are unchanged.
The view works the same on Cloud and self-hosted deployments, using the existing audit history without any additional setup.
Changes
Known limitation
The existing audit logger deduplicates repeated failures without including the MCP server in its deduplication key. As a result, matching failures from different servers may be attributed to the first recorded server. Server-level error rates should therefore be treated as estimates rather than exact per-request metrics.
Latency percentiles use the durations actually stored, without duplicating samples for repeated failures. I've left the logging behavior unchanged to keep this PR focused on #984.
Type
Testing
Local checks:
packages/backend:npm run lint:check,npx --no-install tsc --noEmit -p tsconfig.json, andnpm run buildpassed; 205 audit tests and 8 authentication guard tests passed.packages/frontend:npm run lint,npx --no-install tsc --noEmit -p tsconfig.json, andnpm run buildpassed;npm run test:e2e -- tests/e2e/analytics-tool-performance.spec.tspassed all 6 targeted Playwright tests.packages/cli:npm run buildand generated operation checks passed. A fresh fullnpm testrun using the installed Git Bash passed: 20 passed, 0 failed, 3 skipped (zsh/fish are not installed).node scripts/generate-cli-operations.mjs --checkandnode scripts/generate-llms-txt.mjs --checkpassed.I also tested the Analytics page manually with the local frontend, backend, and native PostgreSQL. Time-range filters, connector/server filters, pagination, error details, and mobile horizontal scrolling worked as expected. The existing Top tools ranking remained intact.
Remaining test limitations:
npm test -- src/common/ssrf.util.spec.ts src/connectors/engines/database.engine.ssrf.spec.ts --runInBand --silentreproduced the same two 5-second timeouts, with 36 tests passing. Both test files and their implementations are unchanged from upstream main. Direct DNS lookups for the test hosts (no-such-host.invalidanddb.internal) took about 11 seconds to returnENOTFOUNDon this machine. The full suite is therefore not marked as passing.Checklist
npm test)Related Issues
Refs #984