You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/01/09 12:56:58 UTC

[skywalking-client-js] 16/32: feat: add fields

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-client-js.git

commit 01ad9cc636cd3b36e8631c64b823e463cd385d8a
Author: Qiuxia Fan <fi...@outlook.com>
AuthorDate: Thu Jan 2 10:52:39 2020 +0800

    feat: add fields
---
 src/index.ts            |  4 ++--
 src/services/types.d.ts | 20 ++++++++++++++++++--
 test/index.html         |  2 +-
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/index.ts b/src/index.ts
index f14b4c3..319921d 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -17,6 +17,6 @@
 
 import ClientMonitor from './monitor';
 
-(window as any).ClientMonitor = ClientMonitor;
+(window as any).ClientMonitor = new ClientMonitor();
 
-export default ClientMonitor;
+export default new ClientMonitor();
diff --git a/src/services/types.d.ts b/src/services/types.d.ts
index 0c30fdd..6662d8c 100644
--- a/src/services/types.d.ts
+++ b/src/services/types.d.ts
@@ -15,12 +15,28 @@
  * limitations under the License.
  */
 export interface TraceFields {
+  reportUrl: string;
   category: string;
   grade: string;
   message: any;
   url: string;
-  line: number;
+  line: number; 
   col: number;
   errorInfo: any;
-  reportUrl: string;
+  performanceInfo?: performanceInfoFields;
+  resources?: any;
+  time?: string;
+  userId?: string;
+  pageUv?: string;
+  pageId?: string;
+  deviceInfo?: any;
+}
+export interface performanceInfoFields {
+  redirectTime: string;
+  dnsTime: string;
+  reqTime: string;
+  analysisTime: string;
+  blankTime: string;
+  domReadyTime: string;
+  loadPage: string;
 }
diff --git a/test/index.html b/test/index.html
index a9f33e4..181f999 100644
--- a/test/index.html
+++ b/test/index.html
@@ -10,7 +10,7 @@
   <div>console test</div>
   <script src="../dist/monitor.js"></script>
   <script>
-    new ClientMonitor().init({
+    ClientMonitor.init({
       reportUrl: "http://baidu.com",
       consoleErrors:true,
       jsErrors: true,