docs: table
1 file changed
tree: da915cd225460f83a5c655c57b8279602ca2bad9
  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

|Parameter|Type|Description|Required|Default Value| |-|:-:|-:| |service|String|project id|true|-| |serviceVersion|String|project verison|true|-| |pagePath|String|project path|true|-| |jsErrors|Boolean|Support js errors monitoring|false|true| |apiErrors|Boolean|Support API errors monitoring|false|true| |resourceErrors|Boolean|Support resource errors monitoring|false|true| |useFmp|Boolean|Collect FMP (first meaningful paint) data of the first screen|false|false| |enableSPA|Boolean|Monitor the page hashchange event and report PV, which is suitable for single page application scenarios|false|false| |autoTracePerf|Boolean|Support automatic sending of performance data|false|true| |vue|Boolean|Support vue errors monitoring|false|true|

  • 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