UNPKG

@hotmeshio/hotmesh

Version:

Serverless Workflow

51 lines (50 loc) 2.26 kB
import { ILogger } from '../logger'; import { StoreService } from '../store'; import { TriggerActivity } from '../../types/activity'; import { AppVID } from '../../types/app'; import { ProviderClient, ProviderTransaction } from '../../types/provider'; import { JobState } from '../../types/job'; import { GetStatsOptions, StatsResponse, IdsResponse, StatsType, StatType } from '../../types/stats'; declare class ReporterService { private appVersion; private logger; private store; static DEFAULT_GRANULARITY: string; constructor(appVersion: AppVID, store: StoreService<ProviderClient, ProviderTransaction>, logger: ILogger); getStats(options: GetStatsOptions): Promise<StatsResponse>; private validateOptions; private generateDateTimeSets; private convertRangeToMinutes; private buildRedisKey; private aggregateData; private buildStatsResponse; private handleSegments; private isoTimestampFromKeyTimestamp; getIds(options: GetStatsOptions, facets: string[], idRange?: [number, number]): Promise<IdsResponse>; private buildIdsResponse; private buildTimeSegments; getUniqueFacets(data: StatsResponse): string[]; getTargetForKey(key: string): string; getTargetForTime(key: string): string; getWorkItems(options: GetStatsOptions, facets: string[]): Promise<string[]>; private buildWorkerLists; /** * called by `trigger` activity to generate the stats that should * be saved to the database. doesn't actually save the stats, but * just generates the info that should be saved */ resolveTriggerStatistics({ stats: statsConfig }: TriggerActivity, context: JobState): StatsType; isGeneralMetric(metric: string): boolean; isMedianMetric(metric: string): boolean; isIndexMetric(metric: string): boolean; static isGeneralMetric(metric: string): boolean; static isMedianMetric(metric: string): boolean; static isIndexMetric(metric: string): boolean; resolveMetric({ metric, target }: { metric: any; target: any; }, context: JobState): StatType; isCardinalMetric(metric: string): boolean; resolveTarget(metric: string, target: string, resolvedValue: string): string; } export { ReporterService };