commit | 3d7177295e55d1db03d3174ca9a3d7615cc44c49 | [log] [tgz] |
---|---|---|
author | zhang-wei <pknfe@outlook.com> | Sun Oct 25 23:11:16 2020 +0800 |
committer | GitHub <noreply@github.com> | Sun Oct 25 23:11:16 2020 +0800 |
tree | 622161b6c7c48bd00ffabc86e11a4b30084a07a8 | |
parent | 6e84d8bb7dc80de4043673a1588abd48526a7f53 [diff] |
Add release doc and script (#16)
Apache SkyWalking Client-side JavaScript exception and tracing library.
the skywalking-client-js runtime library is available at npm
npm install skywalking-client-js --save
SkyWalking Client JS requires SkyWalking 8.2+
User could use register
method to load and report data automatically.
import ClientMonitor from 'skywalking-client-js';
ClientMonitor.register({ service: 'test-ui', pagePath: '/current/page/name', serviceVersion: 'v1.0.0', });
The register method supports the following parameters.
Parameter | Type | Description | Required | Default Value |
---|---|---|---|---|
collector | String | In default, the collected data would be reported to current domain. If you set this, the data could be reported to another domain, NOTE the Cross-Origin Resource Sharing (CORS) issuse and solution. | false | - |
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 sending of performance data automatically. | false | true |
vue | Boolean | Support vue errors monitoring | false | true |
Use the setPerformance
method to report metrics at the moment of page loaded or any other moment meaningful.
ClientMonitor.setPerformance(object)
method to reportimport ClientMonitor from 'skywalking-client-js'; ClientMonitor.setPerformance({ service: 'browser-app', serviceVersion: '1.0.0', pagePath: location.href, useFmp: true });
In spa (single page application) single page application, the page will be refreshed only once. The traditional method only reports PV once after the page loading, but cannot count the PV of each sub-page, and can't make other types of logs aggregate by sub-page.
The SDK provides two processing methods for spa pages:
app.on('routeChange', function (next) { ClientMonitor.setPerformance({ service: 'browser-app', serviceVersion: '1.0.0', pagePath: location.href, useFmp: true }); });
npm install
npm link path/skywalking-client-js
import ClientMonitor from '../node_modules/skywalking-client-js/src/index'; ClientMonitor.register({ service: 'test-ui', pagePath: 'http://localhost:8080/', serviceVersion: 'v1.0.0' });
Front end agent Refer to test project
Start project
npm run start
dev-subscribe@skywalking.apache.org
, follow the reply to subscribe the mail list.#skywalking
channel at Apache Slack. If the linke is not working, find the latest one at Apache INFRA WIKI.Apache 2.0