UNPKG

@fjell/registry

Version:

Dependency injection and service location system for the Fjell ecosystem

105 lines 3.53 kB
import { AllItemTypeArrays } from '@fjell/types'; /** * Represents a service client (another service making the request) */ export interface ServiceClient { /** The type of registry where the calling service is registered */ registryType: string; /** The coordinate of the calling service */ coordinate: { kta: string[]; scopes: string[]; }; } /** * Represents either a service or application client */ export type ClientIdentifier = ServiceClient | string; /** * Represents a specific coordinate call with both kta and scopes */ export interface CoordinateCallRecord { /** The key type array that was requested */ kta: string[]; /** The scopes that were requested (empty array if no scopes) */ scopes: string[]; /** Number of times this exact combination was called */ count: number; /** Breakdown of calls by client */ clientCalls: ClientCallRecord[]; } /** * Represents calls from a specific client */ export interface ClientCallRecord { /** The client that made the calls */ client: ClientIdentifier; /** Number of calls from this client */ count: number; } /** * Statistics about Registry get() method calls with detailed coordinate tracking */ export interface RegistryStatistics { /** Total number of get() calls made on this registry */ totalGetCalls: number; /** Detailed records of each unique coordinate combination and their call counts */ coordinateCallRecords: CoordinateCallRecord[]; /** Summary of calls by client type */ clientSummary: { /** Total calls from services (service-to-service) */ serviceCalls: number; /** Total calls from applications (direct application calls) */ applicationCalls: number; /** Total calls with no client specified */ unidentifiedCalls: number; }; } /** * Internal class for tracking Registry statistics with complex coordinate combinations and client tracking */ export declare class RegistryStats { private totalCalls; private coordinateCalls; /** * Records a get() call for the specified coordinate and client */ recordGetCall<S extends string = any, L1 extends string = any, L2 extends string = any, L3 extends string = any, L4 extends string = any, L5 extends string = any>(kta: AllItemTypeArrays<S, L1, L2, L3, L4, L5>, scopes?: string[], client?: ClientIdentifier): void; /** * Gets the current statistics snapshot */ getStatistics(): RegistryStatistics; /** * Gets call count for a specific coordinate combination */ getCallCount(kta: string[], scopes?: string[]): number; /** * Gets call count for a specific coordinate combination from a specific client */ getCallCountByClient(kta: string[], scopes?: string[], client?: ClientIdentifier): number; /** * Gets total calls for a specific kta (across all scopes) */ getTotalCallsForKta(kta: string[]): number; /** * Gets all unique kta paths that have been called */ getCalledKtaPaths(): string[][]; /** * Creates a normalized scope key from scopes array */ private createScopeKey; /** * Parses a scope key back to scopes array */ private parseScopeKey; /** * Creates a normalized client key from client identifier */ private createClientKey; /** * Parses a client key back to client identifier */ private parseClientKey; } //# sourceMappingURL=RegistryStats.d.ts.map