Class: WebMetricsEmitter

WebMetricsEmitter(batchDelay, autoStart, org, environment, logger)

Class representing an AWS cloudwatch metrics emitter with shortcut methods for web specific dimensions and namespaces.

Constructor

new WebMetricsEmitter(batchDelay, autoStart, org, environment, logger)

Constructor for WebMetricsEmitter
Parameters:
Name Type Description
batchDelay number The number of millisencons to wait before sending the metrics data. If set to null or less than 1, then metrics will be emitted individually.
autoStart bool If true, then the emitter autimatically starts emitting mmetrics after the batch delay.
org string The organisation the metrics are for. This is used to determine the namespace.
environment string Tbe environment the metrics are for. This is added as a dimension to all metrics.
logger Logger The winston logger.
Source:

Methods

addResponseSizeMetric(appName, method, responseSize)

Adds a response size metric for a web request.
Parameters:
Name Type Description
appName string The name of the app.
method string The http method: GET, PUT, etc
responseSize number the size of the response in bytes.
Source:

addResponseTimeMetric(appName, method, responseTime)

Adds a response ellapsed time metric for a web request.
Parameters:
Name Type Description
appName string The name of the app.
method string The http method: GET, PUT, etc
responseTime number the ellapsed time in millseconds of the response.
Source:

addWebMethodCountMetric(appName, method, metricName)

Adds a count metric for a web request.
Parameters:
Name Type Description
appName string The name of the app.
method string The http method: GET, PUT, etc
metricName string the name of the metric.
Source:

addWebMetric(appName, method, metricName, unit, value)

Adds a web metric to the emitter buffer.
Parameters:
Name Type Description
appName string The name of the app.
method string The http method: GET, PUT, etc
metricName string The name of the metric.
unit string The metric unit.
value string The metric value.
Source:

addWebRequestCountMetric(appName)

Adds a count for the request to the application in general, irrespective of the end point.
Parameters:
Name Type Description
appName string The name of the application.
Source:

getNamespace(appName)

Gets the namespace for metric datums based on the org and application name.
Parameters:
Name Type Description
appName srting The name of the web application.
Source: