Skip to content

Commit 8d9aa67

Browse files
authored
Polish the browser doc for client-js 1.0 (#13031)
1 parent 0cd4354 commit 8d9aa67

File tree

5 files changed

+174
-184
lines changed

5 files changed

+174
-184
lines changed

.dlc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
},
1818
{
1919
"pattern": "^http://people.apache.org/committer-index.html"
20+
},
21+
{
22+
"pattern": "^http://www.gnu.org/software/libc/documentation.html"
2023
}
2124
],
2225
"timeout": "10s",

docs/en/api/browser-http-api-protocol.md

Lines changed: 0 additions & 174 deletions
This file was deleted.

docs/en/api/browser-protocol.md

Lines changed: 168 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,176 @@ Browser protocol describes the data format between [skywalking-client-js](https:
44

55
## Overview
66

7-
Browser protocol is defined and provided in [gRPC format](https://github.com/apache/skywalking-data-collect-protocol/blob/master/browser/BrowserPerf.proto),
8-
and also implemented in [HTTP 1.1](browser-http-api-protocol.md)
7+
Browser protocol is defined in [gRPC format](https://github.com/apache/skywalking-data-collect-protocol/blob/master/browser/BrowserPerf.proto) and
8+
exposed in HTTP 1.1 for the browser.
99

10-
### Send performance data and error logs
10+
### Performance Data Report
1111

12-
You can send performance data and error logs using the following services:
12+
Detailed information about data format can be found in [BrowserPerf.proto](https://github.com/apache/skywalking-data-collect-protocol/blob/master/browser/BrowserPerf.proto).
1313

14-
1. `BrowserPerfService#collectPerfData` for performance data format.
15-
1. `BrowserPerfService#collectErrorLogs` for error log format.
14+
#### POST http://localhost:12800/browser/perfData
1615

17-
For error log format, note that:
16+
Send a performance data object in JSON format.
1817

19-
1. `BrowserErrorLog#uniqueId` should be unique in all distributed environments.
18+
Input:
19+
20+
```json
21+
{
22+
"service": "web",
23+
"serviceVersion": "v0.0.1",
24+
"pagePath": "/index.html",
25+
"redirectTime": 10,
26+
"dnsTime": 10,
27+
"ttfbTime": 10,
28+
"tcpTime": 10,
29+
"transTime": 10,
30+
"domAnalysisTime": 10,
31+
"fptTime": 10,
32+
"domReadyTime": 10,
33+
"loadPageTime": 10,
34+
"resTime": 10,
35+
"sslTime": 10,
36+
"ttlTime": 10,
37+
"firstPackTime": 10,
38+
}
39+
```
40+
41+
OutPut:
42+
43+
HTTP Status: 204
44+
45+
#### POST http://localhost:12800/browser/perfData/webVitals
46+
47+
Send a performance data object in JSON format. Since client-js 1.0.0, the following attached metrics are reported.
48+
49+
Input:
50+
51+
```json5
52+
{
53+
"service": "web",
54+
"serviceVersion": "v0.0.1",
55+
"pagePath": "/index.html",
56+
"fmpTime": 10, // Deprecated since skywalking-client-js 1.0. This is no longer recommended. Please use the `useWebVitals` instead.
57+
/* NOTE, Safari does not support all core web vitals, and Firefox does not support `CLS`. */
58+
"clsTime": 10,
59+
"lcpTime": 10,
60+
}
61+
```
62+
63+
OutPut:
64+
65+
HTTP Status: 204
66+
67+
#### POST http://localhost:12800/browser/perfData/webInteractions
68+
69+
Send a performance data object in JSON format. Since client-js 1.0.0, the following attached metrics are reported.
70+
71+
Input:
72+
73+
```json
74+
[
75+
{
76+
"service": "web",
77+
"serviceVersion": "v0.0.1",
78+
"pagePath": "/index.html",
79+
"inpTime": 10,
80+
}
81+
]
82+
```
83+
84+
OutPut:
85+
86+
HTTP Status: 204
87+
88+
#### POST http://localhost:12800/browser/perfData/resources
89+
90+
Send a static resources data object in JSON format. Since client-js 1.0.0, the following attached metrics are reported.
91+
92+
Input:
93+
94+
```json
95+
[
96+
{
97+
"service": "web",
98+
"serviceVersion": "v0.0.1",
99+
"pagePath": "/index.html",
100+
"name": "vue.js",
101+
"duration": 600,
102+
"size": 100000,
103+
"protocol": "h2",
104+
"type": "script",
105+
}
106+
]
107+
```
108+
109+
OutPut:
110+
111+
HTTP Status: 204
112+
113+
### Error Logs Report
114+
115+
#### POST http://localhost:12800/browser/errorLogs
116+
117+
Send an error log object list in JSON format.
118+
119+
Input:
120+
121+
```json
122+
[
123+
{
124+
"uniqueId": "55ec6178-3fb7-43ef-899c-a26944407b01",
125+
"service": "web",
126+
"serviceVersion": "v0.0.1",
127+
"pagePath": "/index.html",
128+
"category": "ajax",
129+
"message": "error",
130+
"line": 1,
131+
"col": 1,
132+
"stack": "error",
133+
"errorUrl": "/index.html"
134+
},
135+
{
136+
"uniqueId": "55ec6178-3fb7-43ef-899c-a26944407b02",
137+
"service": "web",
138+
"serviceVersion": "v0.0.1",
139+
"pagePath": "/index.html",
140+
"category": "ajax",
141+
"message": "error",
142+
"line": 1,
143+
"col": 1,
144+
"stack": "error",
145+
"errorUrl": "/index.html"
146+
}
147+
]
148+
```
149+
150+
OutPut:
151+
152+
HTTP Status: 204
153+
154+
### POST http://localhost:12800/browser/errorLog
155+
156+
Send a single error log object in JSON format.
157+
158+
Input:
159+
160+
```json
161+
{
162+
"uniqueId": "55ec6178-3fb7-43ef-899c-a26944407b01",
163+
"service": "web",
164+
"serviceVersion": "v0.0.1",
165+
"pagePath": "/index.html",
166+
"category": "ajax",
167+
"message": "error",
168+
"line": 1,
169+
"col": 1,
170+
"stack": "error",
171+
"errorUrl": "/index.html"
172+
}
173+
```
174+
175+
OutPut:
176+
177+
HTTP Status: 204
178+
179+
Note, `BrowserErrorLog#uniqueId` should be unique in the whole distributed environments.

docs/en/changes/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
* Add Circuit Breaking mechanism doc.
111111
* Add `Get Node List in the Cluster` API doc.
112112
* Remove `meter.md` doc, because `mal.md` has covered all the content.
113+
* Merge `browser-http-api-protocol.md` doc into `browser-protocol.md`.
113114

114115

115116
All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/224?closed=1)

docs/menu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ catalog:
306306
catalog:
307307
- name: "Meter APIs"
308308
path: "/en/api/meter"
309-
- name: "Browser performance APIs"
309+
- name: "Browser Performance APIs"
310310
path: "/en/api/browser-protocol"
311-
- name: "JVM metrics APIs"
311+
- name: "JVM Metrics APIs"
312312
path: "/en/api/jvm-protocol"
313313
- name: "Logging"
314314
path: "/en/api/log-data-protocol"

0 commit comments

Comments
 (0)