@@ -2,9 +2,6 @@ use std::collections::BTreeMap;
22use std:: ops:: { Deref , DerefMut } ;
33use std:: sync:: { Arc , Mutex , MutexGuard } ;
44
5- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
6- use crate :: profiling;
7-
85use crate :: { protocol, Hub } ;
96
107#[ cfg( feature = "client" ) ]
@@ -230,9 +227,6 @@ impl TransactionContext {
230227/// or ignore it.
231228pub type TracesSampler = dyn Fn ( & TransactionContext ) -> f32 + Send + Sync ;
232229
233- /// Same as TracesSampler but for profiles
234- pub type ProfilesSampler = TracesSampler ;
235-
236230// global API types:
237231
238232/// A wrapper that groups a [`Transaction`] and a [`Span`] together.
@@ -360,8 +354,6 @@ pub(crate) struct TransactionInner {
360354 sampled : bool ,
361355 pub ( crate ) context : protocol:: TraceContext ,
362356 pub ( crate ) transaction : Option < protocol:: Transaction < ' static > > ,
363- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
364- pub ( crate ) profiler_guard : Option < profiling:: ProfilerGuard > ,
365357}
366358
367359type TransactionArc = Arc < Mutex < TransactionInner > > ;
@@ -384,18 +376,6 @@ fn transaction_sample_rate(
384376 }
385377}
386378
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-
399379/// Determine whether the new transaction should be sampled.
400380#[ cfg( feature = "client" ) ]
401381impl Client {
@@ -407,16 +387,6 @@ impl Client {
407387 client_options. traces_sample_rate ,
408388 ) )
409389 }
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- }
420390}
421391
422392/// A running Performance Monitoring Transaction.
@@ -437,14 +407,6 @@ impl Transaction {
437407 client. is_transaction_sampled ( & ctx) ,
438408 Some ( protocol:: Transaction {
439409 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- ) ,
448410 ..Default :: default ( )
449411 } ) ,
450412 ) ,
@@ -454,7 +416,7 @@ impl Transaction {
454416 let context = protocol:: TraceContext {
455417 trace_id : ctx. trace_id ,
456418 parent_span_id : ctx. parent_span_id ,
457- op : Some ( ctx. op . clone ( ) ) ,
419+ op : Some ( ctx. op ) ,
458420 ..Default :: default ( )
459421 } ;
460422
@@ -464,25 +426,13 @@ impl Transaction {
464426 transaction = None ;
465427 client = None ;
466428 }
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- } ;
477429
478430 Self {
479431 inner : Arc :: new ( Mutex :: new ( TransactionInner {
480432 client,
481433 sampled,
482434 context,
483435 transaction,
484- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
485- profiler_guard,
486436 } ) ) ,
487437 }
488438 }
@@ -502,8 +452,6 @@ impl Transaction {
502452 sampled,
503453 context,
504454 transaction : None ,
505- #[ cfg( all( feature = "profiling" , target_family = "unix" ) ) ]
506- profiler_guard : None ,
507455 } ) ) ,
508456 }
509457 }
@@ -577,27 +525,11 @@ impl Transaction {
577525 transaction. environment = opts. environment. clone( ) ;
578526 transaction. sdk = Some ( std:: borrow:: Cow :: Owned ( client. sdk_info. clone( ) ) ) ;
579527
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- } ) ;
586528 drop( inner) ;
587529
588530 let mut envelope = protocol:: Envelope :: new( ) ;
589531 envelope. add_item( transaction) ;
590532
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-
601533 client. send_envelope( envelope)
602534 }
603535 }
0 commit comments