UNPKG

@voicenter-team/mysql-dynamic-cluster

Version:

Galera cluster with implementation of dynamic choose mysql server for queries, caching, hashing it and metrics

75 lines (74 loc) 2.53 kB
/** * Created by Bohdan on Sep, 2021 */ import { IMetric, IMetricOptions } from "../types/MetricsInterfaces"; /** * Real-time metrics */ declare class Metrics { private metricsRepository; private clusterName; private showKeys; /** * Initialize metrics * @param clusterName cluster name used for prefix in metric names * @param showKeys show keys instead names */ init(clusterName: string, showKeys: boolean): void; /** * set value in metric with type Metric * @param metric metric object * @param value the value what need to change * @param options extra options for metric like pool name or service name */ set(metric: IMetric, value: number, options?: IMetricOptions): void; /** * Increase value by 1 in metric with type Counter * @param metric metric object * @param options extra options for metric like pool name or service name */ inc(metric: IMetric, options?: IMetricOptions): void; /** * Decrease value by 1 in metric with type Counter * @param metric metric object * @param options extra options for metric like pool name or service name */ dec(metric: IMetric, options?: IMetricOptions): void; /** * Mark the state to compute frequency in metric with type Meter * @param metric metric object * @param options extra options for metric like pool name or service name */ mark(metric: IMetric, options?: IMetricOptions): void; update(metric: IMetric, value: number, options?: IMetricOptions): void; /** * Check if type is valid for current metric * @param metric metric object * @param type type what need to compare with current metric * @private */ private static _isMetricTypeValid; /** * Get formatted metric key and name with prefix by cluster name and extra options * @param metric metric object * @param useService use service options to generate prop * @param options extra options for metric like pool name or service name * @private */ private _generatePrefixes; /** * Get all metric separated to service metric and common * @param metric metric object * @param options extra options for metric like pool name or/and service name * @private */ private _getMetricValues; /** * Create metric * @param metric metric object * @private */ private _createMetric; } declare const _default: Metrics; export default _default;