Class: LoggingReporter

LoggingReporter

A reporter impl that simply logs the metrics via the Logger.


new LoggingReporter( [options])

Parameters:
Name Type Argument Description
options LoggingReporterOptions <optional>
Source:
Example
const { SelfReportingMetricsRegistry, LoggingReporter } = require('measured-reporting');
const registry = new SelfReportingMetricsRegistry(new LoggingReporter());

Extends

Members


<protected> _defaultDimensions :Dimensions

Map of default dimensions, that should be sent with every metric.

Type:
Inherited From:
Source:

<protected> _defaultReportingIntervalInSeconds :number

The default reporting interval, a number in seconds.
If not overridden via the {@see ReporterOptions}, defaults to 10 seconds.

Type:
  • number
Inherited From:
Source:

<protected> _log :Logger

Loggers to use, defaults to a new console logger if nothing is supplied in options

Type:
  • Logger
Inherited From:
Source:

<protected> _resetMetricsOnInterval :boolean

Flag to indicate if metrics should be reset on each reporting interval.
If not overridden via the {@see ReporterOptions}, defaults to false.

Type:
  • boolean
Inherited From:
Source:

<protected> _unrefTimers :boolean

Flag to indicate if reporting timers should be unref'd.
If not overridden via the {@see ReporterOptions}, defaults to false.

Type:
  • boolean
Inherited From:
Source:

Methods


<protected> _getDimensions(metric)

Parameters:
Name Type Description
metric MetricWrapper

The Wrapped Metric Object.

Inherited From:
Source:
Returns:

The left merged default dimensions with the metric specific dimensions

Type
Dimensions

<protected> _reportMetrics(metrics)

Logs the metrics via the inherited logger instance.

Parameters:
Name Type Description
metrics Array.<MetricWrapper>
Overrides:
Source:

reportMetricOnInterval(metricKey, intervalInSeconds)

Informs the reporter to report a metric on a given interval in seconds.

Parameters:
Name Type Description
metricKey string

The metric key for the metric in the metric registry.

intervalInSeconds number

The interval in seconds to report the metric on.

Inherited From:
Source:

setRegistry(registry)

Sets the registry, this must be called before reportMetricOnInterval.

Parameters:
Name Type Description
registry DimensionAwareMetricsRegistry
Inherited From:
Source:

shutdown()

Clears the intervals that are running to report metrics at an interval, and resets the state.

Inherited From:
Source: