A node package to abstract metric reporting. Currently wraps New Relic metric reporting events.
To add metric tracking to your app simply do the following:
-
Make sure to include the relevant New Relic snippet for your application in the HEAD tag of the root template. The snippet can be found in New Relic under:
Browser > Settings > Application Settings
In most cases this will already be done, usually in a base template of the application. The snippet will determine the
appName
in New Relic.Note: The snippets which include metrics are not included on development stages.
-
Add
lti-metrics
to the application build process (for example by adding it to package.json). -
Include the
lti-metrics
module in the application:import 'lti-metrics';
-
Call the
trackBehaviour
method in the application wherever it is required:lti-metrics.trackBehaviour('assignment-settings-saved', { status: 'failed' });
The trackBehaviour
method accepts two arguments:
name
(String) - The name of the action as it will appear in Insights. Known as actionName
in New Relic.
attrs
(Object) - Optional metadata about the action. Adding it will enable querying data in New Relic using the FACET
option. For example, passing an object which contains status
allows creating a timeseries graph of success vs. failure.
SELECT count(*) FROM PageAction WHERE appName = 'Integrations: LTI' AND actionName = 'assignment-settings-saved' SINCE 1 day AGO FACET status TIMESERIES 1 hour