From 6a4fb3f427dfcea2d74d6912963d99b45c58fe70 Mon Sep 17 00:00:00 2001 From: Stepanov Andrey Date: Sat, 13 May 2023 09:51:42 +0300 Subject: [PATCH] Update index.d.ts - add generic definition for registry using types --- index.d.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/index.d.ts b/index.d.ts index e44b5162..0109de9c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -119,7 +119,7 @@ export const prometheusContentType: PrometheusContentType; */ export const openMetricsContentType: OpenMetricsContentType; -export class AggregatorRegistry extends Registry { +export class AggregatorRegistry extends Registry { /** * Gets aggregated metrics for all workers. * @return {Promise} Promise that resolves with the aggregated @@ -136,7 +136,7 @@ export class AggregatorRegistry extends Registry { * `registry.getMetricsAsJSON()`. * @return {Registry} aggregated registry. */ - static aggregate(metricsArr: Array): Registry; // TODO Promise? + static aggregate(metricsArr: Array): Registry; // TODO Promise? /** * Sets the registry or registries to be aggregated. Call from workers to @@ -145,7 +145,10 @@ export class AggregatorRegistry extends Registry { * aggregated. * @return {void} */ - static setRegistries(regs: Array | Registry): void; + static setRegistries(regs: + | Array | Registry> + | Registry + | Registry): void; } /** @@ -655,13 +658,13 @@ export namespace Summary { /** * Push metrics to a Pushgateway */ -export class Pushgateway { +export class Pushgateway { /** * @param url Complete url to the Pushgateway. If port is needed append url with :port * @param options Options * @param registry Registry */ - constructor(url: string, options?: any, registry?: Registry); + constructor(url: string, options?: any, registry?: Registry); /** * Add metric and overwrite old ones @@ -729,8 +732,8 @@ export function exponentialBuckets( count: number, ): number[]; -export interface DefaultMetricsCollectorConfiguration { - register?: Registry; +export interface DefaultMetricsCollectorConfiguration { + register?: Registry; prefix?: string; gcDurationBuckets?: number[]; eventLoopMonitoringPrecision?: number; @@ -741,8 +744,8 @@ export interface DefaultMetricsCollectorConfiguration { * Configure default metrics * @param config Configuration object for default metrics collector */ -export function collectDefaultMetrics( - config?: DefaultMetricsCollectorConfiguration, +export function collectDefaultMetrics( + config?: DefaultMetricsCollectorConfiguration, ): void; export interface defaultMetrics {