Skip to content

feat: deployment costs endpoint - #202

Merged
vladyslavchuhai-spec merged 5 commits into
developmentfrom
feat/deployment-costs
Sep 15, 2026
Merged

vladyslavchuhai-spec merged 5 commits into
developmentfrom
feat/deployment-costs

Conversation

@vladyslavchuhai-spec

@vladyslavchuhai-spec vladyslavchuhai-spec commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Applicable issues

Description of changes

Problem

Cost analytics existed only per test-suite run (GET /api/v1/test-suite-runs/{id}/costs, average cost per call), so there was no way to answer "how much has this deployment cost over a given period?" — e.g. spend for the current or previous month across all runs. The existing logic also lived inside TestSuiteRunService, which already owns run lifecycle concerns, and the dial-adas query filtered on a json_extract_string(request_tags, 'baggage') expression that no longer matches the upstream usage-log schema.

Solution

Added GET /api/v1/costs?deploymentId&from&to (inclusive epoch-millisecond range) returning totalTestCaseCost and totalMetricEvalCostsum(total_price) per execution phase — via a new CostController + DeploymentCostsResponseDto, with 400 on blank deploymentId or from > to and the existing 502/504 upstream mapping. All cost logic moved out of TestSuiteRunService into a dedicated CostService (reaching run-existence validation through TestSuiteRunService.ensureRunExists, not the repository, per the cross-domain rule), and RunCostQueryBuilder was generalized into AdasCostQueryBuilder with run-scoped (baggage-filtered avg) and deployment-scoped (deployment + request_time columns, sum) aggregate queries. Baggage filtering was corrected to the real usage_request_baggage.baggage field. Includes unit tests for the new builder, service and controller, a functional test, OpenAPI examples, and spec/doc updates.

Checklist

  • corresponding issue(s) linked in the "Development" section of sidebar and referenced in "Applicable issues" section above
  • I have read the "Description of changes" and understood it


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ai-dial-actions

This comment has been minimized.

@ai-dial-actions

This comment has been minimized.

@ai-dial-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@vladyslavchuhai-spec vladyslavchuhai-spec changed the title feat: deployment costs feat: deployment costs endpoint Sep 15, 2026
@vladyslavchuhai-spec
vladyslavchuhai-spec merged commit cf2f933 into development Sep 15, 2026
12 checks passed
@vladyslavchuhai-spec
vladyslavchuhai-spec deleted the feat/deployment-costs branch September 15, 2026 13:49
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.

[Eval] [spike] research requirements for Evaluatee analytics page

3 participants