@withjoy/telemetry

Telemetry support for logging and analytics

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@withjoy/telemetry
1.2.2a month ago6 years agoMinified + gzip package size for @withjoy/telemetry in KB

Readme

@withjoy/telemetry
Telemetry support for logging and analytics.

Publishing

To publish a new version of this module,
  • do not up-version on your development branch
  • merge your fixes into develop
  • from the develop branch,
- version-stamp the "next release" section of 'CHANGELOG.md' - leave an empty "next release" section behind - git commit -m 'updating CHANGELOG.md' to develop - up-version & publish the module, as below:
# the `npm shrinkwrap` for npm@3 isn't adequate -- npm@6 does the trick
nvm use 10

npm version patch  # or whatever is suitable

# TODO: integrate into CircleCI
#   @see 'sdk-js.git'
npm publish

git push
git push --tags

Testing

npm run test

Header Propagation

The telemetry library attempts to appropriately identify the requestId associated with an incoming request. When sending an http request the x-joy-client-header value should be used to properly establish the requestId and ensure compatability with future iterations of the Telemetry library.

Order of precedence to establish requestId

  1. Preserve requestId in the telemetry context.
  2. Extract x-joy-request-id request header value.
  3. Extract client-request-id or clientrequestId request header value. // For mobile integrations
  4. Generate new value to use as requestId

Environment Variables

As processed by deriveTelemetryConfigFromEnvironment
| Name | Purpose | Default | | :--- | :--- | :--- | | JOYCONFIGLELEVEL | logging threshold for LogEntries; @see TelemetryLevel | 10 ('info') | | JOYCONFIGLETOKENSERVER | LogEntries API Token | (blank => LogEntries disabled) | | JOYSERVICEENV | the logged "Service environment" | (blank) | | LOGSILENT | "true" to disable all logging, including internal | (blank => false) | | LOGCONSOLE | "true" to enable 'human-friendly' logging | (blank => false) | | LOGLEVEL | logging threshold for console; @see TelemetryLevel | -1 (even lower than 'trace' = everything) | | STDOUTLOG | "true" to enable JSON logging | (blank => false) | | JOYCONFIGSEGMENTWRITEKEY | Segment write key | (blank => false) |