@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,
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 thex-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
- Preserve
requestId
in the telemetry context. - Extract
x-joy-request-id
request header value. - Extract
client-request-id
orclientrequestId
request header value. // For mobile integrations - Generate new value to use as
requestId
Environment Variables
As processed byderiveTelemetryConfigFromEnvironment
| 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) |