JSPM

  • Created
  • Published
  • Downloads 3303
  • Score
    100M100P100Q117044F
  • License SEE LICENSE IN LICENSE.md

TrackJS agent for NodeJS

Package Exports

  • trackjs-node

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (trackjs-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme


This Agent is in Beta, not recommended for production use until v1.0.0.

TrackJS Agent for NodeJS

Reference

Usage

To use the Agent, call TrackJS.install(options) as soon as possible in your code. It will install the monitors into the environment.

// ES5
const TrackJS = require("trackjs-node");
// ES6
import { TrackJS } from "trackjs-node";

TrackJS.install({
  token: "YOUR_TOKEN"
  /* other options */
});

To add more context to your errors, add context and metadata through the agent.

TrackJS.configure({
  sessionId: "session",
  version: "1.0.0",
  userId: "frank@gmail.com"
});

// or add arbitrary keys for whatever you think is important
TrackJS.addMetadata({
  foo: "bar"
});

TrackJS will automatically gather Telemetry and send errors. If you want to trigger these events yourself, you can.

TrackJS.addLogTelemetry("warn", [
  "a warning message",
  {
    /*state object*/
  }
]);

TrackJS.track(new Error("everything has gone wrong!"));