new SignalFxSelfReportingMetricsRegistry()
Extends
Members
-
<protected> _log :Logger
-
Loggers to use, defaults to a new console logger if nothing is supplied in options
Type:
- Logger
- Inherited From:
- Source:
-
<protected> _registry :DimensionAwareMetricsRegistry
-
Type:
-
<protected> _reporters :Reporter
-
Type:
Methods
-
getOrCreateCachedGauge(name [, dimensions] [, publishingIntervalInSeconds])
-
Creates a CachedGauge or gets the existing CachedGauge for a given name and dimension combo.
Parameters:
Name Type Argument Description name
string The Metric name.
valueProducingPromiseCallback.
function cachedGaugeUpdateIntervalInSeconds.
number dimensions
Dimensions <optional>
any custom Dimensions for the Metric.
publishingIntervalInSeconds
number <optional>
a optional custom publishing interval.
- Inherited From:
- Source:
Returns:
- Type
- CachedGauge
-
getOrCreateCounter(name [, dimensions] [, publishingIntervalInSeconds])
-
Creates a Counter or gets the existing Counter for a given name and dimension combo
Parameters:
Name Type Argument Description name
string The Metric name
dimensions
Dimensions <optional>
any custom Dimensions for the Metric
publishingIntervalInSeconds
number <optional>
a optional custom publishing interval
- Inherited From:
- Source:
Returns:
- Type
- Counter
-
getOrCreateGauge(name, callback [, dimensions] [, publishingIntervalInSeconds])
-
Creates a Gauge or gets the existing Gauge for a given name and dimension combo
Parameters:
Name Type Argument Description name
string The Metric name
callback
function The callback that will return a value to report to signal fx
dimensions
Dimensions <optional>
any custom Dimensions for the Metric
publishingIntervalInSeconds
number <optional>
a optional custom publishing interval
- Inherited From:
- Source:
Returns:
- Type
- Gauge
Example
// https://nodejs.org/api/process.html#process_process_memoryusage // Report heap total and heap used at the default interval registry.getOrCreateGauge( 'process-memory-heap-total', () => { return process.memoryUsage().heapTotal } ); registry.getOrCreateGauge( 'process-memory-heap-used', () => { return process.memoryUsage().heapUsed } )
-
getOrCreateHistogram(name [, dimensions] [, publishingIntervalInSeconds])
-
Creates a Histogram or gets the existing Histogram for a given name and dimension combo
Parameters:
Name Type Argument Description name
string The Metric name
dimensions
Dimensions <optional>
any custom Dimensions for the Metric
publishingIntervalInSeconds
number <optional>
a optional custom publishing interval
- Inherited From:
- Source:
Returns:
- Type
- Histogram
-
getOrCreateMeter(name, dimensions, publishingIntervalInSeconds)
-
Meters are not reported to SignalFx.
Meters do not make sense to use with SignalFx because the same values can be calculated
using simple counters and aggregations within SignalFx itself.Parameters:
Name Type Description name
string The Metric name
dimensions
Dimensions any custom Dimensions for the Metric
publishingIntervalInSeconds
number a optional custom publishing interval
- Overrides:
- Source:
Returns:
- Type
- NoOpMeter | *
-
getOrCreateSettableGauge(name [, dimensions] [, publishingIntervalInSeconds])
-
Creates a SettableGauge or gets the existing SettableGauge for a given name and dimension combo.
Parameters:
Name Type Argument Description name
string The Metric name
dimensions
Dimensions <optional>
any custom Dimensions for the Metric
publishingIntervalInSeconds
number <optional>
a optional custom publishing interval
- Inherited From:
- Source:
Returns:
- Type
- SettableGauge
-
getOrCreateTimer(name, dimensions, publishingIntervalInSeconds)
-
Creates a Timer or get the existing Timer for a given name and dimension combo with a NoOpMeter.
Parameters:
Name Type Description name
string The Metric name
dimensions
Dimensions any custom Dimensions for the Metric
publishingIntervalInSeconds
number a optional custom publishing interval
- Overrides:
- Source:
Returns:
- Type
- Timer
-
register(name, metric [, dimensions] [, publishingIntervalInSeconds])
-
Registers a manually created Metric.
Parameters:
Name Type Argument Description name
string The Metric name
metric
Metric The Metric to register
dimensions
Dimensions <optional>
any custom Dimensions for the Metric
publishingIntervalInSeconds
number <optional>
a optional custom publishing interval
- Inherited From:
- Source:
Example
const settableGauge = new SettableGauge(5); // register the gauge and have it report to every 10 seconds registry.register('my-gauge', settableGauge, {}, 10); interval(() => { // such as cpu % used determineAValueThatCannotBeSync((value) => { settableGauge.update(value); }) }, 10000)
-
sendEvent(eventType [, category] [, dimensions] [, properties] [, timestamp])
-
Function exposes the event API of Signal Fx.
See https://github.com/signalfx/signalfx-nodejs#sending-events for more details.Parameters:
Name Type Argument Description eventType
string The event type (name of the event time series).
category
SignalFxEventCategoryId <optional>
the category of event. See module:SignalFxEventCategories. Value by default is USER_DEFINED.
dimensions
Dimensions <optional>
a map of event dimensions, empty dictionary by default
properties
Object.<string, string> <optional>
a map of extra properties on that event, empty dictionary by default
timestamp
number <optional>
a timestamp, by default is current time.
Example
const { SignalFxSelfReportingMetricsRegistry, SignalFxMetricsReporter, SignalFxEventCategories } = require('measured-signalfx-reporter'); const registry = new SignalFxSelfReportingMetricsRegistry(new SignalFxMetricsReporter(signalFxClient)); registry.sendEvent('uncaughtException', SignalFxEventCategories.ALERT);
-
shutdown()
-
Calls end on all metrics in the registry that support end() and calls end on the reporter