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. |
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. |
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. |
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. |
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. |
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. |
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. |