From b87dd433fb5bd737f012500f5c7c8b10a50c2b16 Mon Sep 17 00:00:00 2001 From: rstiller Date: Sat, 3 Nov 2018 14:48:34 +0100 Subject: [PATCH] some logger-reporter options optional --- lib/metrics/reporter/logger-reporter.ts | 46 +++------------------- lib/metrics/reporter/metric-reporter.ts | 6 +-- lib/metrics/reporter/scheduled-reporter.ts | 6 +-- package.json | 2 +- 4 files changed, 12 insertions(+), 48 deletions(-) diff --git a/lib/metrics/reporter/logger-reporter.ts b/lib/metrics/reporter/logger-reporter.ts index f4580fe8..9710b026 100644 --- a/lib/metrics/reporter/logger-reporter.ts +++ b/lib/metrics/reporter/logger-reporter.ts @@ -1,17 +1,17 @@ import "source-map-support/register"; -import { Clock, StdClock } from "../clock"; +import { StdClock } from "../clock"; import { Counter, MonotoneCounter } from "../counter"; import { Gauge } from "../gauge"; import { Histogram } from "../histogram"; import { Meter } from "../meter"; import { MetricRegistry } from "../metric-registry"; -import { MILLISECOND, TimeUnit } from "../time-unit"; +import { MILLISECOND } from "../time-unit"; import { Timer } from "../timer"; import { Logger } from "./logger"; import { ReportingContext, ReportingResult } from "./metric-reporter"; import { MetricType } from "./metric-type"; -import { ScheduledMetricReporter, ScheduledMetricReporterOptions, Scheduler } from "./scheduled-reporter"; +import { ScheduledMetricReporter, ScheduledMetricReporterOptions } from "./scheduled-reporter"; /** * Helper interface to abstract a log-line. @@ -66,7 +66,7 @@ export interface LoggerReporterOptions extends ScheduledMetricReporterOptions { * @type {Logger} * @memberof LoggerReporterOptions */ - log: Logger; + log?: Logger; } /** @@ -100,43 +100,7 @@ export class LoggerReporter extends ScheduledMetricReporter} - */ - tags?: Map; - }) { + }: LoggerReporterOptions) { super({ clock, log, diff --git a/lib/metrics/reporter/metric-reporter.ts b/lib/metrics/reporter/metric-reporter.ts index eb5f7210..8d467b1b 100644 --- a/lib/metrics/reporter/metric-reporter.ts +++ b/lib/metrics/reporter/metric-reporter.ts @@ -86,21 +86,21 @@ export interface MetricReporterOptions { * @type {Clock} * @memberof MetricReporterOptions */ - readonly clock: Clock; + readonly clock?: Clock; /** * Timeout in minutes a metric need to be included in the report without having changed. * * @type {number} * @memberof MetricReporterOptions */ - minReportingTimeout: number; + minReportingTimeout?: number; /** * Tags for this reporter instance - to be combined with the tags of each metric while reporting. * * @type {Map} * @memberof MetricReporterOptions */ - tags: Map; + tags?: Map; } /** diff --git a/lib/metrics/reporter/scheduled-reporter.ts b/lib/metrics/reporter/scheduled-reporter.ts index 7cc6225e..b5d43e79 100644 --- a/lib/metrics/reporter/scheduled-reporter.ts +++ b/lib/metrics/reporter/scheduled-reporter.ts @@ -22,21 +22,21 @@ export interface ScheduledMetricReporterOptions extends MetricReporterOptions { * @type {number} * @memberof ScheduledMetricReporterOptions */ - readonly reportInterval: number; + readonly reportInterval?: number; /** * Time unit for the reporting interval. * * @type {TimeUnit} * @memberof ScheduledMetricReporterOptions */ - readonly unit: TimeUnit; + readonly unit?: TimeUnit; /** * The scheduler function used to trigger reporting runs. * * @type {Scheduler} * @memberof ScheduledMetricReporterOptions */ - readonly scheduler: Scheduler; + readonly scheduler?: Scheduler; } /** diff --git a/package.json b/package.json index 8303dd21..f1cd827e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "inspector-metrics", "description": "monitoring / metric library similar to http://metrics.dropwizard.io", "homepage": "https://rstiller.github.io/inspector-metrics/", - "version": "1.13.0-rc.1", + "version": "1.13.0-rc.2", "main": "./build/lib/metrics/index.js", "typings": "./build/lib/metrics/index.d.ts", "bugs": {