rum-diary-endpoint
NodeJS endpoint to listen for rum-diary-js-client statistics and send them to one or more collectors
Installation
- Install via npm:
npm install rum-diary-endpoint
- Install via github:
git clone https://github.com/shane-tomlinson/rum-diary-endpoint.git
Connect/Express middleware
- Include
rum-diary-endpoint
. - Initialize one or more collectors.
- Create a middleware, configuring it with the endpoint path and a list of collectors.
- Register the middleware with the application.
const rumDiaryEndpoint = ; const consoleCollector = ; const middleware = rumDiaryEndpoint; app;
Advanced Use
Custom collectors
A collector is an object that must expose three functions:
write
- write results to the collector.flush
- flush any cached data to the collector.destroy
- the collector is about to be destroyed.
const metricsDatabase = ; const metricsDatabaseCollector = { return metricsDatabase; } { return metricsDatabase; } { return metricsDatabase; }; const middleware = rumDiaryEndpoint; app;
Send results to rum-diary.org
const rumDiaryEndpoint = ; const httpCollector = collectorUrl: 'https://rum-diary.org/metrics'; const middleware = rumDiaryEndpoint; app;
Direct use
Composite
The Composite
can be used directly.
const rumDiaryEndpoint = ;const RumDiaryComposite = rumDiaryEndpointComposite;const consoleCollector = ; const metricsCollectors = collectors: consoleCollector ; ... app;
Handler
If custom route handling is needed, the Handler
object can be instantiated
and initialized independently.
const rumDiaryEndpoint = ;const RumDiaryHandler = rumDiaryEndpointHandler;const consoleCollector = ; const handler = collectors: consoleCollector ; ... app;
Prerequisites:
- nodejs >= 0.10.0
Get Involved:
Author:
- Shane Tomlinson
- shane@shanetomlinson.com
- stomlinson@mozilla.com
- set117@yahoo.com
- https://shanetomlinson.com
- https://github.com/shane-tomlinson
- @shane_tomlinson
License:
This software is available under version 2.0 of the MPL: