@apica-io/apica-rum
v1.0.1
Published
RUM browser instrumentation scripts
Readme
Apica RUM implementation based on OTEL Browser SDK and Web Vitals.
The script instruments user interactions and web page behavior in both auto and manual mode. Emits the 3 Otel signals - Logs, Metrics and Traces. Any OTEL compatible endpoint that is reachable from the script can be used as sink endpoints. Script has been fined tuned for Ascent as backend.
- Build step
There are multiple ways to build the script as follows
a. Need to use a build tool like parcel to get the final script
npx parcel build apicarumwrapper.js --dist-dir dist --no-source-mapsb. Use the script commands available in package.json
npm run buildMinified RUM file will be available in the dist directory
This can then be added to a page as below.
This will launch auto instrumentation for the page and usage metrics will start ingestion, the script exposes the internal meters via returned object, this can be used to add custom meters e.g Business metrics of some kind
- Manual instrumentation
Internal meters corresponding to logs, metrics and traces used by the script are exposed via the returned object from the init call. These meters can be used to do custom instrumentation, for example some business metrics that is relevant for monitoring.
- Code structure
Code structure follows the three main signals - log.js, metric.js and trace.js These are used in ApicaRum.js apicarumwrapper.js is a wrapper for direct script import scenarios e.g script delivery via a CDN
- Packaging
Its possible to create a local package for distribution by executing
npm run pack
- Publish to npm
Package needs to be published under Apica account, this requires a npm user account under Apica. Need to login first and then publish
npm login
npm run publish
