UNPKG

@iota-big3/sdk-gateway

Version:

Universal API Gateway with protocol translation, intelligent routing, rate limiting, health checking, and caching

51 lines 1.44 kB
/** * @iota-big3/sdk-gateway * Cost Tracker - Real-time cost tracking and billing */ import { CostConfig, GatewayRequest, GatewayResponse } from '../types/gateway-types'; import { SimpleTimeSeriesStore } from '../utils/minimal-analytics'; export declare class CostTracker { private metricsStore; private userCosts; private serviceCosts; private isEnabled; constructor(metricsStore: SimpleTimeSeriesStore); /** * Track cost for a request */ trackCostAsync(request: GatewayRequest, response: GatewayResponse, costConfig: CostConfig): Promise<void>; /** * Calculate cost based on model */ private calculateCost; /** * Check if user has exceeded cost limits */ private checkCostLimitsAsync; /** * Get user cost for a period */ private getUserCostAsync; /** * Handle cost limit exceeded */ private handleCostLimitExceededAsync; /** * Get cost report */ getCostReportAsync(period?: 'hour' | 'day' | 'month'): Promise<{ totalCost: number; costByUser: Record<string, number>; costByService: Record<string, number>; period: string; startTime?: number; endTime?: number; currency: string; generatedAt: number; }>; /** * Reset cost counters (for billing cycles) */ resetCounters(): void; } //# sourceMappingURL=cost-tracker.d.ts.map