@@ -2,9 +2,6 @@ use std::collections::BTreeMap;
2
2
use std:: ops:: { Deref , DerefMut } ;
3
3
use std:: sync:: { Arc , Mutex , MutexGuard } ;
4
4
5
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
6
- use crate :: profiling;
7
-
8
5
use crate :: { protocol, Hub } ;
9
6
10
7
#[ cfg( feature = "client" ) ]
@@ -230,9 +227,6 @@ impl TransactionContext {
230
227
/// or ignore it.
231
228
pub type TracesSampler = dyn Fn ( & TransactionContext ) -> f32 + Send + Sync ;
232
229
233
- /// Same as TracesSampler but for profiles
234
- pub type ProfilesSampler = TracesSampler ;
235
-
236
230
// global API types:
237
231
238
232
/// A wrapper that groups a [`Transaction`] and a [`Span`] together.
@@ -360,8 +354,6 @@ pub(crate) struct TransactionInner {
360
354
sampled : bool ,
361
355
pub ( crate ) context : protocol:: TraceContext ,
362
356
pub ( crate ) transaction : Option < protocol:: Transaction < ' static > > ,
363
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
364
- pub ( crate ) profiler_guard : Option < profiling:: ProfilerGuard > ,
365
357
}
366
358
367
359
type TransactionArc = Arc < Mutex < TransactionInner > > ;
@@ -384,18 +376,6 @@ fn transaction_sample_rate(
384
376
}
385
377
}
386
378
387
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
388
- fn profile_sample_rate (
389
- profile_sampler : Option < & ProfilesSampler > ,
390
- ctx : & TransactionContext ,
391
- profiles_sample_rate : f32 ,
392
- ) -> f32 {
393
- match ( profile_sampler, profiles_sample_rate) {
394
- ( Some ( profile_sampler) , _) => profile_sampler ( ctx) ,
395
- ( None , profiles_sample_rate) => profiles_sample_rate,
396
- }
397
- }
398
-
399
379
/// Determine whether the new transaction should be sampled.
400
380
#[ cfg( feature = "client" ) ]
401
381
impl Client {
@@ -407,16 +387,6 @@ impl Client {
407
387
client_options. traces_sample_rate ,
408
388
) )
409
389
}
410
-
411
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
412
- pub ( crate ) fn is_profile_sampled ( & self , ctx : & TransactionContext ) -> bool {
413
- let client_options = self . options ( ) ;
414
- self . sample_should_send ( profile_sample_rate (
415
- client_options. traces_sampler . as_deref ( ) ,
416
- ctx,
417
- client_options. profiles_sample_rate ,
418
- ) )
419
- }
420
390
}
421
391
422
392
/// A running Performance Monitoring Transaction.
@@ -437,14 +407,6 @@ impl Transaction {
437
407
client. is_transaction_sampled ( & ctx) ,
438
408
Some ( protocol:: Transaction {
439
409
name : Some ( ctx. name . clone ( ) ) ,
440
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
441
- active_thread_id : Some (
442
- // NOTE: `pthread_t` is a `usize`, so clippy is wrong complaining about this cast
443
- #[ allow( clippy:: unnecessary_cast) ]
444
- unsafe {
445
- libc:: pthread_self ( ) as u64
446
- } ,
447
- ) ,
448
410
..Default :: default ( )
449
411
} ) ,
450
412
) ,
@@ -454,7 +416,7 @@ impl Transaction {
454
416
let context = protocol:: TraceContext {
455
417
trace_id : ctx. trace_id ,
456
418
parent_span_id : ctx. parent_span_id ,
457
- op : Some ( ctx. op . clone ( ) ) ,
419
+ op : Some ( ctx. op ) ,
458
420
..Default :: default ( )
459
421
} ;
460
422
@@ -464,25 +426,13 @@ impl Transaction {
464
426
transaction = None ;
465
427
client = None ;
466
428
}
467
- // if the transaction was sampled then a profile, linked to the transaction,
468
- // might as well be sampled
469
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
470
- let profiler_guard = if sampled {
471
- client
472
- . as_deref ( )
473
- . and_then ( |cli| profiling:: start_profiling ( cli, & ctx) )
474
- } else {
475
- None
476
- } ;
477
429
478
430
Self {
479
431
inner : Arc :: new ( Mutex :: new ( TransactionInner {
480
432
client,
481
433
sampled,
482
434
context,
483
435
transaction,
484
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
485
- profiler_guard,
486
436
} ) ) ,
487
437
}
488
438
}
@@ -502,8 +452,6 @@ impl Transaction {
502
452
sampled,
503
453
context,
504
454
transaction : None ,
505
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
506
- profiler_guard : None ,
507
455
} ) ) ,
508
456
}
509
457
}
@@ -577,27 +525,11 @@ impl Transaction {
577
525
transaction. environment = opts. environment. clone( ) ;
578
526
transaction. sdk = Some ( std:: borrow:: Cow :: Owned ( client. sdk_info. clone( ) ) ) ;
579
527
580
- // if the profiler is running for the given transaction
581
- // then call finish_profiling to return the profile
582
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
583
- let sample_profile = inner. profiler_guard. take( ) . and_then( |profiler_guard| {
584
- profiling:: finish_profiling( & transaction, profiler_guard, inner. context. trace_id)
585
- } ) ;
586
528
drop( inner) ;
587
529
588
530
let mut envelope = protocol:: Envelope :: new( ) ;
589
531
envelope. add_item( transaction) ;
590
532
591
- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
592
- if let Some ( sample_profile) = sample_profile {
593
- if !sample_profile. profile. samples. is_empty( ) {
594
- envelope. add_item( sample_profile) ;
595
- }
596
- else {
597
- sentry_debug!( "the profile is being dropped because it contains no samples" ) ;
598
- }
599
- }
600
-
601
533
client. send_envelope( envelope)
602
534
}
603
535
}
0 commit comments