@prismshadow/penguin-library-observability · library/observability/src/observability.ts:428

UsageQueries

interface

UsageQueries: the mechanism UsageService implements.

API

@Interface()
export abstract class UsageQueries {
  abstract query(projectId: string, q: UsageQuery): Promise<UsageResponse>;
  abstract queryErrors(projectId: string, q: UsageErrorsQuery): UsageErrorsPage;
  abstract clearErrors(projectId: string, q: UsageErrorsClearQuery): number;
  abstract modelTotals(projectId: string): UsageModelTotals;
  abstract costBySession(
      projectId: string,
      sessionIds: readonly string[],
      fromTs: string,
      toTs: string,
    ): Promise<Opaque<"CostBySession", { bySession: Map<string, number>; unpriced: boolean }>>;
  abstract dailyCostForSessions(
      projectId: string,
      sessionIds: readonly string[],
      fromTs: string,
      toTs: string,
    ): Promise<Array<{ date: string; cost: number }>>;
}

Contract Topology

Static AST wiring across @Module / @Provide / @Use

Members (6)

query

query(projectId: string, q: UsageQuery): Promise<UsageResponse>
@paramprojectIdstring
@paramqUsageQuery
@returnsPromise<UsageResponse>

queryErrors

queryErrors(projectId: string, q: UsageErrorsQuery): UsageErrorsPage
@paramprojectIdstring
@paramqUsageErrorsQuery
@returnsUsageErrorsPage

clearErrors

clearErrors(projectId: string, q: UsageErrorsClearQuery): number
@paramprojectIdstring
@paramqUsageErrorsClearQuery
@returnsnumber

modelTotals

modelTotals(projectId: string): UsageModelTotals
@paramprojectIdstring
@returnsUsageModelTotals

costBySession

costBySession(projectId: string, sessionIds: readonly string[], fromTs: string, toTs: string): Promise<Opaque<"CostBySession", { bySession: Map<string, number>; unpriced: boolean }>>
@paramprojectIdstring
@paramsessionIdsreadonly string[]
@paramfromTsstring
@paramtoTsstring
@returnsPromise<Opaque<"CostBySession", { bySession: Map<string, number>; unpriced: boolean }>>

dailyCostForSessions

dailyCostForSessions(projectId: string, sessionIds: readonly string[], fromTs: string, toTs: string): Promise<Array<{ date: string; cost: number }>>
@paramprojectIdstring
@paramsessionIdsreadonly string[]
@paramfromTsstring
@paramtoTsstring
@returnsPromise<Array<{ date: string; cost: number }>>