File tree 5 files changed +19
-0
lines changed
5 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ export class BrowserBackend extends BaseBackend<BrowserOptions> {
62
62
...this . _options . transportOptions ,
63
63
dsn : this . _options . dsn ,
64
64
tunnel : this . _options . tunnel ,
65
+ sendClientReports : this . _options . sendClientReports ,
65
66
_metadata : this . _options . _metadata ,
66
67
} ;
67
68
Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ export function init(options: BrowserOptions = {}): void {
88
88
if ( options . autoSessionTracking === undefined ) {
89
89
options . autoSessionTracking = true ;
90
90
}
91
+ if ( options . sendClientReports === undefined ) {
92
+ options . sendClientReports = true ;
93
+ }
91
94
92
95
initAndBind ( BrowserClient , options ) ;
93
96
Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ export abstract class BaseTransport implements Transport {
67
67
* @inheritDoc
68
68
*/
69
69
public recordLostEvent ( type : Outcome ) : void {
70
+ if ( ! this . options . sendClientReport ) {
71
+ return ;
72
+ }
73
+
70
74
logger . log ( `Adding ${ type } outcome` ) ;
71
75
this . _outcomes [ type ] = ( this . _outcomes [ type ] ?? 0 ) + 1 ;
72
76
}
@@ -75,6 +79,10 @@ export abstract class BaseTransport implements Transport {
75
79
* Send outcomes as an envelope
76
80
*/
77
81
protected _flushOutcomes ( ) : void {
82
+ if ( ! this . options . sendClientReport ) {
83
+ return ;
84
+ }
85
+
78
86
if ( ! navigator || typeof navigator . sendBeacon !== 'function' ) {
79
87
logger . warn ( 'Beacon API not available, skipping sending outcomes.' ) ;
80
88
return ;
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ export interface Options {
132
132
*/
133
133
autoSessionTracking ?: boolean ;
134
134
135
+ /**
136
+ * Automatically send SDK Client Report
137
+ */
138
+ sendClientReports ?: boolean ;
139
+
135
140
/**
136
141
* Initial data to populate scope.
137
142
*/
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ export interface TransportOptions {
64
64
fetchParameters ?: { [ key : string ] : string } ;
65
65
/** The envelope tunnel to use. */
66
66
tunnel ?: string ;
67
+ /** Automatically send SDK Client Report */
68
+ sendClientReport ?: boolean ;
67
69
/**
68
70
* Set of metadata about the SDK that can be internally used to enhance envelopes and events,
69
71
* and provide additional data about every request.
You can’t perform that action at this time.
0 commit comments