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

UsageStore

interface

UsageStore: the mechanism UsageRepo implements.

API

@Interface()
export abstract class UsageStore {
  abstract insert(r: UsageRecordInsert): void;
  abstract bucketByModel(
      projectId: string,
      f?: UsageFilter,
      tiers?: readonly PeakTier[],
    ): UsageModelSums[];
  abstract groupsByModel(
      projectId: string,
      groupBy: UsageGroupBy,
      f?: UsageFilter,
      tiers?: readonly PeakTier[],
    ): UsageGroupModelSums[];
  abstract seriesByModel(
      projectId: string,
      granularity: UsageSeriesGranularity,
      f?: UsageFilter,
      tiers?: readonly PeakTier[],
    ): UsageSeriesModelSums[];
  abstract toolsByModel(
      projectId: string,
      f?: UsageFilter,
      tiers?: readonly PeakTier[],
    ): UsageToolModelSums[];
  abstract agentSeries(
      projectId: string,
      granularity: UsageSeriesGranularity,
      f?: UsageFilter,
    ): UsageAgentBucketCount[];
  abstract distinctAgentIds(projectId: string): string[];
  abstract distinctModels(projectId: string): { provider: string; modelId: string }[];
  abstract deleteByProject(projectId: string): void;
}

Contract Topology

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

Members (9)

insert

insert(r: UsageRecordInsert): void
@paramrUsageRecordInsert
@returnsvoid

bucketByModel

bucketByModel(projectId: string, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageModelSums[]
@paramprojectIdstring
@paramf?UsageFilter
@paramtiers?readonly PeakTier[]
@returnsUsageModelSums[]

groupsByModel

groupsByModel(projectId: string, groupBy: UsageGroupBy, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageGroupModelSums[]
@paramprojectIdstring
@paramgroupByUsageGroupBy
@paramf?UsageFilter
@paramtiers?readonly PeakTier[]
@returnsUsageGroupModelSums[]

seriesByModel

seriesByModel(projectId: string, granularity: UsageSeriesGranularity, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageSeriesModelSums[]
@paramprojectIdstring
@paramgranularityUsageSeriesGranularity
@paramf?UsageFilter
@paramtiers?readonly PeakTier[]
@returnsUsageSeriesModelSums[]

toolsByModel

toolsByModel(projectId: string, f?: UsageFilter, tiers?: readonly PeakTier[]): UsageToolModelSums[]
@paramprojectIdstring
@paramf?UsageFilter
@paramtiers?readonly PeakTier[]
@returnsUsageToolModelSums[]

agentSeries

agentSeries(projectId: string, granularity: UsageSeriesGranularity, f?: UsageFilter): UsageAgentBucketCount[]
@paramprojectIdstring
@paramgranularityUsageSeriesGranularity
@paramf?UsageFilter
@returnsUsageAgentBucketCount[]

distinctAgentIds

distinctAgentIds(projectId: string): string[]
@paramprojectIdstring
@returnsstring[]

distinctModels

distinctModels(projectId: string): { provider: string; modelId: string }[]
@paramprojectIdstring
@returns{ provider: string; modelId: string }[]

deleteByProject

deleteByProject(projectId: string): void
@paramprojectIdstring
@returnsvoid