@@ -10,8 +10,6 @@ use sentry_types::protocol::v7::SessionUpdate;
10
10
use sentry_types:: random_uuid;
11
11
12
12
use crate :: constants:: SDK_INFO ;
13
- #[ cfg( feature = "metrics" ) ]
14
- use crate :: metrics:: { self , MetricAggregator } ;
15
13
use crate :: protocol:: { ClientSdkInfo , Event } ;
16
14
use crate :: session:: SessionFlusher ;
17
15
use crate :: types:: { Dsn , Uuid } ;
@@ -46,8 +44,6 @@ pub struct Client {
46
44
options : ClientOptions ,
47
45
transport : TransportArc ,
48
46
session_flusher : RwLock < Option < SessionFlusher > > ,
49
- #[ cfg( feature = "metrics" ) ]
50
- metric_aggregator : RwLock < Option < MetricAggregator > > ,
51
47
integrations : Vec < ( TypeId , Arc < dyn Integration > ) > ,
52
48
pub ( crate ) sdk_info : ClientSdkInfo ,
53
49
}
@@ -68,17 +64,10 @@ impl Clone for Client {
68
64
transport. clone ( ) ,
69
65
self . options . session_mode ,
70
66
) ) ) ;
71
- #[ cfg( feature = "metrics" ) ]
72
- let metric_aggregator = RwLock :: new ( Some ( MetricAggregator :: new (
73
- transport. clone ( ) ,
74
- & self . options ,
75
- ) ) ) ;
76
67
Client {
77
68
options : self . options . clone ( ) ,
78
69
transport,
79
70
session_flusher,
80
- #[ cfg( feature = "metrics" ) ]
81
- metric_aggregator,
82
71
integrations : self . integrations . clone ( ) ,
83
72
sdk_info : self . sdk_info . clone ( ) ,
84
73
}
@@ -147,16 +136,10 @@ impl Client {
147
136
options. session_mode ,
148
137
) ) ) ;
149
138
150
- #[ cfg( feature = "metrics" ) ]
151
- let metric_aggregator =
152
- RwLock :: new ( Some ( MetricAggregator :: new ( transport. clone ( ) , & options) ) ) ;
153
-
154
139
Client {
155
140
options,
156
141
transport,
157
142
session_flusher,
158
- #[ cfg( feature = "metrics" ) ]
159
- metric_aggregator,
160
143
integrations,
161
144
sdk_info,
162
145
}
@@ -323,23 +306,11 @@ impl Client {
323
306
}
324
307
}
325
308
326
- /// Captures a metric and sends it to Sentry on the next flush.
327
- #[ cfg( feature = "metrics" ) ]
328
- pub fn add_metric ( & self , metric : metrics:: Metric ) {
329
- if let Some ( ref aggregator) = * self . metric_aggregator . read ( ) . unwrap ( ) {
330
- aggregator. add ( metric)
331
- }
332
- }
333
-
334
309
/// Drains all pending events without shutting down.
335
310
pub fn flush ( & self , timeout : Option < Duration > ) -> bool {
336
311
if let Some ( ref flusher) = * self . session_flusher . read ( ) . unwrap ( ) {
337
312
flusher. flush ( ) ;
338
313
}
339
- #[ cfg( feature = "metrics" ) ]
340
- if let Some ( ref aggregator) = * self . metric_aggregator . read ( ) . unwrap ( ) {
341
- aggregator. flush ( ) ;
342
- }
343
314
if let Some ( ref transport) = * self . transport . read ( ) . unwrap ( ) {
344
315
transport. flush ( timeout. unwrap_or ( self . options . shutdown_timeout ) )
345
316
} else {
@@ -356,8 +327,6 @@ impl Client {
356
327
/// `shutdown_timeout` in the client options.
357
328
pub fn close ( & self , timeout : Option < Duration > ) -> bool {
358
329
drop ( self . session_flusher . write ( ) . unwrap ( ) . take ( ) ) ;
359
- #[ cfg( feature = "metrics" ) ]
360
- drop ( self . metric_aggregator . write ( ) . unwrap ( ) . take ( ) ) ;
361
330
let transport_opt = self . transport . write ( ) . unwrap ( ) . take ( ) ;
362
331
if let Some ( transport) = transport_opt {
363
332
sentry_debug ! ( "client close; request transport to shut down" ) ;
0 commit comments