Implement the Performance API (v2/performance/metrics) - #630
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 33 |
| Duplication | 3 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
CI status: Unit Tests, Codacy, CodeQL, dependency-review, and the demo-app uploads all pass. Integration Tests currently fails, but not because of this PR — the only failing test is Root cause: the live API requires |
Fills in PerformanceEndpoint, which was previously an empty stub annotated @unfinished. Adds all 11 documented endpoints: performance results (account-wide and per-test), test assertions, baseline (read/reset), discarded-outlier history and management, test history, and metric regimes (read/acknowledge). Adds matching parameter builders and response models under model.performance, following the same conventions used for the Insights endpoints. Fixes #150 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
16ca469 to
2526eaa
Compare
Description
PerformanceEndpointwas previously an empty stub (no methods at all, annotated@Unfinished). This PR fills it in with all 11 endpoints documented for the Performance API:getPerformanceResults(GetPerformanceMetricsParameter)—GET /v2/performance/metrics/getPerformanceResults(jobID)/getPerformanceResults(jobID, full)—GET /v2/performance/metrics/{job_id}/getTestAssertions(jobID, metricNames, orderIndex)—GET /v2/performance/metrics/{job_id}/assert/getTestBaseline(jobID, BaselineParameter)—GET /v2/performance/metrics/{job_id}/baseline/getBaselineResetHistory(jobID)—GET /v2/performance/metrics/{job_id}/baseline/reset/resetBaseline(jobID)—POST /v2/performance/metrics/{job_id}/baseline/reset/getDiscardedTests(jobID, orderIndex[, limit])—GET /v2/performance/metrics/{job_id}/discarded/discardOutliers(jobID, orderIndex)—POST /v2/performance/metrics/{job_id}/discarded/getTestHistory(jobID, orderIndex[, limit])—GET /v2/performance/metrics/{job_id}/history/getMetricRegimes(jobID, metricNames, orderIndex[, includeBaseline])—GET /v2/performance/metrics/{job_id}/regimes/acknowledgeRegimes(jobID, orderIndex)—POST /v2/performance/metrics/{job_id}/regimes/acknowledge/Since this covers every documented endpoint in the Performance API, the
@Unfinishedannotation has been removed fromPerformanceEndpoint.Response models live under
com.saucelabs.saucerest.model.performance, and follow the field-naming/parameter-builder conventions established in #629 (the Insights endpoints). Two endpoints (GET /v2/performance/metrics/andGET .../baseline/) have dedicated parameter builders since they combine required and optional filters; the rest take their (few, mostly required) parameters directly as method arguments, matching the pattern used elsewhere in the codebase (e.g.BuildsEndpoint.getSpecificBuild) for calls with no real optional filtering.Motivation and Context
Closes #150 — the library exposed a
PerformanceEndpointclass with zero methods, despite the Performance API being explicitly requested.How Has This Been Tested?
mvn test-compile— full compile of main and test sources.mvn test -Dtest=com.saucelabs.saucerest.unit.**— full unit suite, including new tests for both parameter builders (GetPerformanceMetricsParameterTest,BaselineParameterTest) coveringtoMap()serialization.PerformanceEndpointTest) for the account-widegetPerformanceResultscall, following the existing pattern (InsightsEndpointTest) of exercising real endpoints against live credentials. The other 10 endpoints are scoped to a specificjob_idwith performance/Lighthouse data already recorded against it, which isn't something this environment can reliably provision, so I did not add live integration tests for those — happy to add them if maintainers have a fixture job available in CI.Types of changes
Screenshots (if appropriate):
N/A
Checklist
Further comments
Unlike the Insights API (#629), the documented Performance API surface is small and self-contained (one path prefix, 11 endpoints), so this PR implements it in full rather than a scoped subset.
🤖 Generated with Claude Code