diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ac13a33..9a3e4f38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ project adheres to [Semantic Versioning](http://semver.org/). ### Changed +- types: converted all the generic Metric types to be optional + - The `done()` functions returned by `gauge.startTimer()` and `summary.startTimer()` now return the timed duration. Histograms already had this behavior. diff --git a/index.d.ts b/index.d.ts index 3c60f643..a99bcd0c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -116,7 +116,7 @@ export class AggregatorRegistry extends Registry { /** * General metric type */ -export type Metric = +export type Metric = | Counter | Gauge | Summary @@ -163,7 +163,7 @@ export interface CounterConfiguration /** * A counter is a cumulative metric that represents a single numerical value that only ever goes up */ -export class Counter { +export class Counter { /** * @param configuration Configuration when creating a Counter metric. Name and Help is required. */ @@ -232,7 +232,7 @@ export interface GaugeConfiguration /** * A gauge is a metric that represents a single numerical value that can arbitrarily go up and down. */ -export class Gauge { +export class Gauge { /** * @param configuration Configuration when creating a Gauge metric. Name and Help is mandatory */ @@ -368,7 +368,7 @@ export interface HistogramConfiguration /** * A histogram samples observations (usually things like request durations or response sizes) and counts them in configurable buckets */ -export class Histogram { +export class Histogram { /** * @param configuration Configuration when creating the Histogram. Name and Help is mandatory */ @@ -470,7 +470,7 @@ export interface SummaryConfiguration /** * A summary samples observations */ -export class Summary { +export class Summary { /** * @param configuration Configuration when creating Summary metric. Name and Help is mandatory */ @@ -571,7 +571,7 @@ export class Pushgateway { */ pushAdd( params: Pushgateway.Parameters, - ): Promise<{ resp?: unknown, body?: unknown }>; + ): Promise<{ resp?: unknown; body?: unknown }>; /** * Overwrite all metric (using PUT to Pushgateway) @@ -579,7 +579,7 @@ export class Pushgateway { */ push( params: Pushgateway.Parameters, - ): Promise<{ resp?: unknown, body?: unknown }>; + ): Promise<{ resp?: unknown; body?: unknown }>; /** * Delete all metrics for jobName @@ -587,7 +587,7 @@ export class Pushgateway { */ delete( params: Pushgateway.Parameters, - ): Promise<{ resp?: unknown, body?: unknown }>; + ): Promise<{ resp?: unknown; body?: unknown }>; } export namespace Pushgateway {