Skip to content

Implement the Performance API (v2/performance/metrics) - #630

Merged
diemol merged 1 commit into
mainfrom
support-performance-endpoint-150
Sep 16, 2026
Merged

diemol merged 1 commit into
mainfrom
support-performance-endpoint-150

Conversation

@diemol

@diemol diemol commented Sep 16, 2026

Copy link
Copy Markdown
Member

Description

PerformanceEndpoint was 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 @Unfinished annotation has been removed from PerformanceEndpoint.

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/ and GET .../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 PerformanceEndpoint class 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) covering toMap() serialization.
  • Added a live-API integration test (PerformanceEndpointTest) for the account-wide getPerformanceResults call, following the existing pattern (InsightsEndpointTest) of exercising real endpoints against live credentials. The other 10 endpoints are scoped to a specific job_id with 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

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (change which improves current code base; please describe the change)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Screenshots (if appropriate):

N/A

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests passed locally
  • I have added necessary documentation (if appropriate)

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

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 33 complexity · 3 duplication

Metric Results
Complexity 33
Duplication 3

View in Codacy

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.

@diemol

diemol commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

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 InsightsEndpointTest.getTestTrendsTest, which is unrelated to the Performance work here (it exercises GET /v1/analytics/trends/tests from #629). This PR's own new PerformanceEndpointTest.getPerformanceResultsTest passes.

Root cause: the live API requires interval on that endpoint and returns a 422 when it's omitted, despite the docs listing it as optional. Fix and root-cause writeup are in #631. Once that merges, rebasing this branch on main should clear the Integration Tests failure here too.

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>
@diemol
diemol force-pushed the support-performance-endpoint-150 branch from 16ca469 to 2526eaa Compare September 16, 2026 14:40
@diemol
diemol merged commit 08dacaa into main Sep 16, 2026
12 checks passed
@diemol
diemol deleted the support-performance-endpoint-150 branch September 16, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Performance endpoint

1 participant