Skip to content

RunCostRecalculationService

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Maintenance service that recalculates the cost of all runs against the current pricing source (catalog/configuration).

public sealed class RunCostRecalculationService

objectRunCostRecalculationService

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Used only by the POST /api/stats/recalculate-costs endpoint. Every call is a full recalculation — there is no “only unknown ones” filter, because the endpoint’s purpose is to apply the current pricing to history as-is. Since the provider is not stored on historical rows, resolution is done by model name alone.

RunCostRecalculationService(IRunStore, IRunPricingResolver)

Section titled “ RunCostRecalculationService(IRunStore, IRunPricingResolver)”

Creates a new recalculation service.

public RunCostRecalculationService(IRunStore store, IRunPricingResolver resolver)

store IRunStore

The run store.

resolver IRunPricingResolver

The cost resolver.

ArgumentNullException

One of the dependencies is null.

RecalculateAsync(string, CancellationToken)

Section titled “ RecalculateAsync(string, CancellationToken)”

Recalculates the cost of all runs for a tenant.

public ValueTask<RunCostRecalculationResult> RecalculateAsync(string tenantId, CancellationToken cancellationToken = default)

tenantId string

The tenant identity.

cancellationToken CancellationToken

The cancellation token.

ValueTask<RunCostRecalculationResult>

The counts of runs considered, updated, and still unknown.