docs: table
1 file changed
tree: 59f9c262e3a092150bbb951a99baccc9240f6617
  1. .github/
  2. src/
  3. .asf.yaml
  4. .gitignore
  5. .prettierrc
  6. index.js
  7. LICENSE
  8. package-lock.json
  9. package.json
  10. README.md
  11. server.js
  12. tsconfig.json
  13. tslint.json
  14. webpack.config.js
README.md

Apache SkyWalking Client JS

Apache SkyWalking Client-side JavaScript exception and tracing library.

  • Make browser as a start of whole distributed tracing
  • Provide metrics and error collection to SkyWalking backend.
  • Lightweight

Usage

  • Install: the skywalking-client-js runtime library is available at npm
npm install skywalking-client-js --save
  • Init SDK
import ClientMonitor from 'skywalking-client-js';
ClientMonitor.register({
  service: 'test-ui',
  pagePath: 'http://localhost:8080/',
  serviceVersion: 'v1.0.0',
});
  • SDK Reference
ParameterTypeDescriptionRequiredDefault Value
serviceStringproject idtrue-
serviceVersionStringproject verisontrue-
pagePathStringproject pathtrue-
jsErrorsBooleanSupport js errors monitoringfalsetrue
apiErrorsBooleanSupport API errors monitoringfalsetrue
resourceErrorsBooleanSupport resource errors monitoringfalsetrue
useFmpBooleanCollect FMP (first meaningful paint) data of the first screenfalsefalse
enableSPABooleanMonitor the page hashchange event and report PV, which is suitable for single page application scenariosfalsefalse
autoTracePerfBooleanSupport automatic sending of performance datafalsetrue
vueBooleanSupport vue errors monitoringfalsetrue
  • API Reference

register()
After the SDK is initially completed, it calls the register() interface to revise some of the configuration items. For details of the SDK configuration item, see SDK reference.

register() grammar

ClientMonitor.register(params);

register() call parameters
|Parameter|Type|Description|Required|Default Value| |----|----|---------|----|----| |params|Object|Configuration items and values to be modified|true|-|

setPerformance()
After the page onLoad, call the setPerformance() interface to report the default performance metrics.

How to use setPerformance()

  1. Set the SDK configuration item autoTracePerf to false to turn off automatic reporting performance metrics and wait for manual triggering of escalation.
  2. Call ClientMonitor.setPerformance (object) method to manually report user-defined indicators. In this process, the default performance metrics will also be automatically reported. note:

setPerformance() examples of use

import ClientMonitor from 'skywalking-client-js';

ClientMonitor.setPerformance({
  reportUrl: 'http://example.com',
  service: 'skywalking-ui',
  serviceVersion: 'v8.1.0',
  pagePath: location.href,
  useFmp: true
});

Development

  • npm install
  • npm link skywalking-client-js
  • npm run start

Contact Us

  • Submit an issue
  • Mail list: dev@skywalking.apache.org. Mail to dev-subscribe@skywalking.apache.org, follow the reply to subscribe the mail list.
  • Join #skywalking channel at Apache Slack. If the linke is not working, find the latest one at Apache INFRA WIKI.
  • QQ Group: 392443393(2000/2000, not available), 901167865(available)

License

Apache 2.0