File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export abstract class BrowserClient implements IBrowserClient {
8787 message,
8888 stack,
8989 traces,
90- browser : this . browser
90+ details : this . browser
9191 } ;
9292
9393 return err ;
@@ -155,7 +155,7 @@ export abstract class BrowserClient implements IBrowserClient {
155155 message,
156156 stack,
157157 traces,
158- browser : this . browser
158+ details : this . browser
159159 } ;
160160
161161 this . sendError ( err ) ;
@@ -167,6 +167,6 @@ export abstract class BrowserClient implements IBrowserClient {
167167 }
168168
169169 private get incidentsUrl ( ) {
170- return ` ${ CAPTURE_ENDPOINT . INCIDENT } / ${ this . configs . options . projectId } ` ;
170+ return CAPTURE_ENDPOINT . INCIDENT ;
171171 }
172172}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ export { BrowserClient } from "./client";
22export type {
33 Dictionary ,
44 IBrowserClient ,
5- TraceoOptions ,
5+ ClientOptions ,
66 TraceoBrowserError as TraceoError
77} from "./types/client" ;
88export { VERSION } from "./version" ;
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export class Performance {
1010 constructor ( configs : BrowserClientConfigType ) {
1111 this . batch = new Batch ( configs , {
1212 headers : configs ?. headers ,
13- url : ` ${ CAPTURE_ENDPOINT . BROWSER_PERFS } / ${ configs ?. options ?. projectId } `
13+ url : CAPTURE_ENDPOINT . BROWSER_PERFS
1414 } ) ;
1515 }
1616
@@ -25,9 +25,17 @@ export class Performance {
2525 // overrride to this.batch.add which inlcude some necessary data for each perfs
2626 public addToBatch ( payload : BatchPayload ) : void {
2727 const pathname = utils . pathname ( ) ;
28+ const { browser, platform } = utils . browserDetails ( ) ;
2829
2930 const batchPayload : BatchPayload = {
3031 view : pathname ,
32+ browser : {
33+ name : browser . name ,
34+ version : browser . version
35+ } ,
36+ platform : {
37+ type : platform ?. type
38+ } ,
3139 ...payload
3240 } ;
3341
Original file line number Diff line number Diff line change @@ -46,6 +46,6 @@ export class Transport {
4646 }
4747
4848 private get clientURL ( ) : URL {
49- return new URL ( this . _options . options . url ) ;
49+ return new URL ( this . _options . options . host ) ;
5050 }
5151}
Original file line number Diff line number Diff line change @@ -5,13 +5,14 @@ export type BrowserClientConfigType = {
55
66export interface TraceoOptions {
77 apiKey : string ;
8- projectId : string ;
9- url : string ;
8+ host : string ;
109 offline ?: boolean ;
1110 performance ?: boolean ;
1211}
1312
14- export interface TraceoBrowserError extends Error { }
13+ export interface ClientOptions extends Omit < TraceoOptions , "apiKey" > { } ;
14+
15+ export interface TraceoBrowserError extends Error { }
1516
1617export interface IBrowserClient {
1718 handleError ( error : TraceoBrowserError ) : void ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export type BrowserIncidentType = {
2525 type ?: string ;
2626 message ?: string ;
2727 stack ?: string ;
28- browser : BrowserInfoType ;
28+ details : object ;
2929 traces ?: Trace [ ] ;
3030} ;
3131
Original file line number Diff line number Diff line change 11import { Logger } from "./logger" ;
22import { Metrics } from "./metrics" ;
33import { Scrapper } from "./scrapper" ;
4- import { TraceoOptions } from "./types" ;
4+ import { ClientOptions , TraceoOptions } from "./types" ;
55import { TRACEO_SDK_VERSION } from "./version" ;
66
77export class Client {
@@ -13,14 +13,18 @@ export class Client {
1313 public readonly logger : Logger ;
1414 public options : TraceoOptions ;
1515
16- constructor ( options : TraceoOptions ) {
16+ constructor ( apiKey : string , options : ClientOptions ) {
1717 this . configGlobalClient ( ) ;
1818
19- this . options = options ;
19+ this . options = {
20+ ...options ,
21+ apiKey
22+ } ;
23+
2024 this . headers = {
2125 "x-sdk-name" : "node" ,
2226 "x-sdk-version" : TRACEO_SDK_VERSION ,
23- "x-sdk-key" : this . options . apiKey
27+ "x-sdk-key" : apiKey
2428 } ;
2529
2630 this . logger = new Logger ( ) ;
@@ -57,10 +61,6 @@ export class Client {
5761 }
5862 }
5963
60- // private metrics(): IClientMetrics {
61- // return this._metrics;
62- // }
63-
6464 private configGlobalClient ( ) : void {
6565 global [ "__TRACEO__" ] = this ;
6666 }
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export class HttpModule {
1515 private host : string ;
1616
1717 constructor ( ) {
18- this . host = Client . config . url ;
18+ this . host = Client . config . host ;
1919 }
2020
2121 public static getInstance ( ) {
@@ -64,7 +64,7 @@ export class HttpModule {
6464 port : reqUrl . port ,
6565 host : reqUrl . hostname ,
6666 method,
67- path : ` ${ path . pathname } / ${ Client . config . projectId } `
67+ path : path . pathname
6868 } ;
6969 }
7070
Original file line number Diff line number Diff line change 11export interface TraceoGlobal {
2- projectId ?: number ;
32 offline ?: boolean ;
43 connection ?: {
54 host : string ;
Original file line number Diff line number Diff line change 11export interface TraceoOptions {
22 apiKey : string ;
3- projectId : string ;
43 offline ?: boolean ;
5- url : string ;
4+ host : string ;
65 /*
76 Determining if Traceo should collect metrics from the application.
87 */
@@ -20,6 +19,8 @@ export interface TraceoOptions {
2019 scrapLogsInterval ?: number ;
2120}
2221
22+ export interface ClientOptions extends Omit < TraceoOptions , "apiKey" > { }
23+
2324export interface ErrorMiddlewareOptions {
2425 allowLocalhost ?: boolean ;
2526 allowHttp ?: boolean ;
You can’t perform that action at this time.
0 commit comments