Skip to content

Commit

Permalink
some logger-reporter options optional
Browse files Browse the repository at this point in the history
  • Loading branch information
rstiller committed Nov 3, 2018
1 parent 279cce5 commit b87dd43
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 48 deletions.
46 changes: 5 additions & 41 deletions lib/metrics/reporter/logger-reporter.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -66,7 +66,7 @@ export interface LoggerReporterOptions extends ScheduledMetricReporterOptions {
* @type {Logger}
* @memberof LoggerReporterOptions
*/
log: Logger;
log?: Logger;
}

/**
Expand Down Expand Up @@ -100,43 +100,7 @@ export class LoggerReporter extends ScheduledMetricReporter<LoggerReporterOption
scheduler = setInterval,
minReportingTimeout = 1,
tags = new Map(),
}: {
/**
* The logger instance used to report metrics.
* @type {Logger}
*/
log?: Logger,
/**
* Reporting interval in the time-unit of {@link #unit}.
* @type {number}
*/
reportInterval?: number;
/**
* The time-unit of the reporting interval.
* @type {TimeUnit}
*/
unit?: TimeUnit;
/**
* The clock instance used determine the current time.
* @type {Clock}
*/
clock?: Clock;
/**
* The scheduler function used to trigger reporting.
* @type {Scheduler}
*/
scheduler?: Scheduler;
/**
* The timeout in which a metrics gets reported wether it's value has changed or not.
* @type {number}
*/
minReportingTimeout?: number;
/**
* Common tags for this reporter instance.
* @type {Map<string, string>}
*/
tags?: Map<string, string>;
}) {
}: LoggerReporterOptions) {
super({
clock,
log,
Expand Down
6 changes: 3 additions & 3 deletions lib/metrics/reporter/metric-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>}
* @memberof MetricReporterOptions
*/
tags: Map<string, string>;
tags?: Map<string, string>;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/metrics/reporter/scheduled-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit b87dd43

Please sign in to comment.