From 3e6e0daa3e22f2a25b91c1bfc9b3042c6e36f61c Mon Sep 17 00:00:00 2001 From: Francesco Vigliaturo Date: Tue, 27 Jun 2023 13:27:06 +0200 Subject: [PATCH] Remove profiling support --- sentry-core/Cargo.toml | 11 -- sentry-core/src/clientoptions.rs | 18 +- sentry-core/src/lib.rs | 3 - sentry-core/src/performance.rs | 70 +------ sentry-core/src/profiling.rs | 269 -------------------------- sentry-types/src/protocol/envelope.rs | 18 +- sentry-types/src/protocol/mod.rs | 1 - sentry-types/src/protocol/profile.rs | 139 ------------- sentry-types/src/protocol/v7.rs | 21 +- sentry/Cargo.toml | 2 - sentry/src/transports/ratelimit.rs | 6 - 11 files changed, 5 insertions(+), 553 deletions(-) delete mode 100644 sentry-core/src/profiling.rs delete mode 100644 sentry-types/src/protocol/profile.rs diff --git a/sentry-core/Cargo.toml b/sentry-core/Cargo.toml index a7672b2d..bae4d4ad 100644 --- a/sentry-core/Cargo.toml +++ b/sentry-core/Cargo.toml @@ -26,8 +26,6 @@ client = ["rand"] # and macros actually expand features (and extern crate) where they are used! debug-logs = ["dep:log"] test = ["client"] -profiling = ["pprof", "build_id", "uuid", "sys-info", "findshlibs", "rustc_version_runtime", "libc", "indexmap"] -frame-pointer = ["pprof?/frame-pointer"] [dependencies] log = { version = "0.4.8", optional = true, features = ["std"] } @@ -37,15 +35,6 @@ sentry-types = { version = "0.31.5", path = "../sentry-types" } serde = { version = "1.0.104", features = ["derive"] } serde_json = { version = "1.0.46" } uuid = { version = "1.0.0", features = ["v4", "serde"], optional = true } -sys-info = { version = "0.9.1", optional = true } -build_id = { version = "0.2.1", optional = true } -findshlibs = { version = "=0.10.2", optional = true } -rustc_version_runtime = { version = "0.2.1", optional = true } -indexmap = { version = "1.9.1", optional = true } - -[target.'cfg(target_family = "unix")'.dependencies] -pprof = { version = "0.11.0", optional = true, default-features = false } -libc = { version = "^0.2.66", optional = true } [dev-dependencies] # Because we re-export all the public API in `sentry`, we actually run all the diff --git a/sentry-core/src/clientoptions.rs b/sentry-core/src/clientoptions.rs index d0fe15d0..9926cbcd 100644 --- a/sentry-core/src/clientoptions.rs +++ b/sentry-core/src/clientoptions.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use std::time::Duration; use crate::constants::USER_AGENT; -use crate::performance::{ProfilesSampler, TracesSampler}; +use crate::performance::TracesSampler; use crate::protocol::{Breadcrumb, Event}; use crate::types::Dsn; use crate::{Integration, IntoDsn, TransportFactory}; @@ -80,17 +80,6 @@ pub struct ClientOptions { /// Return a sample rate between 0.0 and 1.0 for the transaction in question. /// Takes priority over the `sample_rate`. pub traces_sampler: Option>, - /// Enables profiling - pub enable_profiling: bool, - /// The sample rate for profiling a transactions. (0.0 - 1.0, defaults to 0.0) - /// - /// This represents the probability that a sampled transaction - /// will send a profile to Sentry - pub profiles_sample_rate: f32, - /// If given, called with a TransactionContext for each profile to determine the sampling rate. - /// - /// Return a sample rate between 0.0 and 1.0 for the profile in question. - pub profiles_sampler: Option>, /// Maximum number of breadcrumbs. (defaults to 100) pub max_breadcrumbs: usize, /// Attaches stacktraces to messages. @@ -213,8 +202,6 @@ impl fmt::Debug for ClientOptions { .as_ref() .map(|arc| std::ptr::addr_of!(**arc)), ) - .field("enable_profiling", &self.enable_profiling) - .field("profiles_sample_rate", &self.profiles_sample_rate) .field("max_breadcrumbs", &self.max_breadcrumbs) .field("attach_stacktrace", &self.attach_stacktrace) .field("send_default_pii", &self.send_default_pii) @@ -249,9 +236,6 @@ impl Default for ClientOptions { sample_rate: 1.0, traces_sample_rate: 0.0, traces_sampler: None, - enable_profiling: false, - profiles_sample_rate: 0.0, - profiles_sampler: None, max_breadcrumbs: 100, attach_stacktrace: false, send_default_pii: false, diff --git a/sentry-core/src/lib.rs b/sentry-core/src/lib.rs index e70f6742..aa513aa7 100644 --- a/sentry-core/src/lib.rs +++ b/sentry-core/src/lib.rs @@ -150,9 +150,6 @@ pub use crate::client::Client; #[cfg(feature = "test")] pub mod test; -#[cfg(all(feature = "profiling", not(target_os = "windows")))] -mod profiling; - // public api from other crates #[doc(inline)] pub use sentry_types as types; diff --git a/sentry-core/src/performance.rs b/sentry-core/src/performance.rs index db5f6f66..ea328313 100644 --- a/sentry-core/src/performance.rs +++ b/sentry-core/src/performance.rs @@ -2,9 +2,6 @@ use std::collections::BTreeMap; use std::ops::{Deref, DerefMut}; use std::sync::{Arc, Mutex, MutexGuard}; -#[cfg(all(feature = "profiling", target_family = "unix"))] -use crate::profiling; - use crate::{protocol, Hub}; #[cfg(feature = "client")] @@ -230,9 +227,6 @@ impl TransactionContext { /// or ignore it. pub type TracesSampler = dyn Fn(&TransactionContext) -> f32 + Send + Sync; -/// Same as TracesSampler but for profiles -pub type ProfilesSampler = TracesSampler; - // global API types: /// A wrapper that groups a [`Transaction`] and a [`Span`] together. @@ -360,8 +354,6 @@ pub(crate) struct TransactionInner { sampled: bool, pub(crate) context: protocol::TraceContext, pub(crate) transaction: Option>, - #[cfg(all(feature = "profiling", target_family = "unix"))] - pub(crate) profiler_guard: Option, } type TransactionArc = Arc>; @@ -384,18 +376,6 @@ fn transaction_sample_rate( } } -#[cfg(all(feature = "profiling", target_family = "unix"))] -fn profile_sample_rate( - profile_sampler: Option<&ProfilesSampler>, - ctx: &TransactionContext, - profiles_sample_rate: f32, -) -> f32 { - match (profile_sampler, profiles_sample_rate) { - (Some(profile_sampler), _) => profile_sampler(ctx), - (None, profiles_sample_rate) => profiles_sample_rate, - } -} - /// Determine whether the new transaction should be sampled. #[cfg(feature = "client")] impl Client { @@ -407,16 +387,6 @@ impl Client { client_options.traces_sample_rate, )) } - - #[cfg(all(feature = "profiling", target_family = "unix"))] - pub(crate) fn is_profile_sampled(&self, ctx: &TransactionContext) -> bool { - let client_options = self.options(); - self.sample_should_send(profile_sample_rate( - client_options.traces_sampler.as_deref(), - ctx, - client_options.profiles_sample_rate, - )) - } } /// A running Performance Monitoring Transaction. @@ -437,14 +407,6 @@ impl Transaction { client.is_transaction_sampled(&ctx), Some(protocol::Transaction { name: Some(ctx.name.clone()), - #[cfg(all(feature = "profiling", target_family = "unix"))] - active_thread_id: Some( - // NOTE: `pthread_t` is a `usize`, so clippy is wrong complaining about this cast - #[allow(clippy::unnecessary_cast)] - unsafe { - libc::pthread_self() as u64 - }, - ), ..Default::default() }), ), @@ -454,7 +416,7 @@ impl Transaction { let context = protocol::TraceContext { trace_id: ctx.trace_id, parent_span_id: ctx.parent_span_id, - op: Some(ctx.op.clone()), + op: Some(ctx.op), ..Default::default() }; @@ -464,16 +426,6 @@ impl Transaction { transaction = None; client = None; } - // if the transaction was sampled then a profile, linked to the transaction, - // might as well be sampled - #[cfg(all(feature = "profiling", target_family = "unix"))] - let profiler_guard = if sampled { - client - .as_deref() - .and_then(|cli| profiling::start_profiling(cli, &ctx)) - } else { - None - }; Self { inner: Arc::new(Mutex::new(TransactionInner { @@ -481,8 +433,6 @@ impl Transaction { sampled, context, transaction, - #[cfg(all(feature = "profiling", target_family = "unix"))] - profiler_guard, })), } } @@ -502,8 +452,6 @@ impl Transaction { sampled, context, transaction: None, - #[cfg(all(feature = "profiling", target_family = "unix"))] - profiler_guard: None, })), } } @@ -577,27 +525,11 @@ impl Transaction { transaction.environment = opts.environment.clone(); transaction.sdk = Some(std::borrow::Cow::Owned(client.sdk_info.clone())); - // if the profiler is running for the given transaction - // then call finish_profiling to return the profile - #[cfg(all(feature = "profiling", target_family = "unix"))] - let sample_profile = inner.profiler_guard.take().and_then(|profiler_guard| { - profiling::finish_profiling(&transaction, profiler_guard, inner.context.trace_id) - }); drop(inner); let mut envelope = protocol::Envelope::new(); envelope.add_item(transaction); - #[cfg(all(feature = "profiling", target_family = "unix"))] - if let Some(sample_profile) = sample_profile { - if !sample_profile.profile.samples.is_empty(){ - envelope.add_item(sample_profile); - } - else { - sentry_debug!("the profile is being dropped because it contains no samples"); - } - } - client.send_envelope(envelope) } } diff --git a/sentry-core/src/profiling.rs b/sentry-core/src/profiling.rs deleted file mode 100644 index 16a0334e..00000000 --- a/sentry-core/src/profiling.rs +++ /dev/null @@ -1,269 +0,0 @@ -use indexmap::set::IndexSet; -use std::collections::HashMap; -use std::fmt; -use std::sync::atomic::{AtomicBool, Ordering}; - -use findshlibs::{SharedLibrary, SharedLibraryId, TargetSharedLibrary, TARGET_SUPPORTED}; - -use sentry_types::protocol::v7::Profile; -use sentry_types::protocol::v7::{ - DebugImage, DebugMeta, DeviceMetadata, OSMetadata, RuntimeMetadata, RustFrame, Sample, - SampleProfile, SymbolicDebugImage, ThreadMetadata, TraceId, Transaction, TransactionMetadata, - Version, -}; -use sentry_types::{CodeId, DebugId, Uuid}; - -#[cfg(feature = "client")] -use crate::Client; -use crate::TransactionContext; - -static PROFILER_RUNNING: AtomicBool = AtomicBool::new(false); - -pub(crate) struct ProfilerGuard(pprof::ProfilerGuard<'static>); - -impl fmt::Debug for ProfilerGuard { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "[ProfilerGuard]") - } -} - -pub(crate) fn start_profiling(client: &Client, ctx: &TransactionContext) -> Option { - // if profiling is not enabled or the profile was not sampled - // return None immediately - if !client.options().enable_profiling || !client.is_profile_sampled(ctx) { - return None; - } - - // if no other profile is being collected, then - // start the profiler - if let Ok(false) = - PROFILER_RUNNING.compare_exchange(false, true, Ordering::SeqCst, Ordering::SeqCst) - { - let profile_guard_builder = pprof::ProfilerGuardBuilder::default() - .frequency(100) - .blocklist(&["libc", "libgcc", "pthread", "vdso"]) - .build(); - - match profile_guard_builder { - Ok(guard_builder) => return Some(ProfilerGuard(guard_builder)), - Err(err) => { - sentry_debug!( - "could not start the profiler due to the following error: {:?}", - err - ); - PROFILER_RUNNING.store(false, Ordering::SeqCst); - } - } - } - None -} - -pub(crate) fn finish_profiling( - transaction: &Transaction, - profiler_guard: ProfilerGuard, - trace_id: TraceId, -) -> Option { - let sample_profile = match profiler_guard.0.report().build_unresolved() { - Ok(report) => Some(get_profile_from_report(&report, trace_id, transaction)), - Err(err) => { - sentry_debug!( - "could not build the profile result due to the error: {}", - err - ); - None - } - }; - - PROFILER_RUNNING.store(false, Ordering::SeqCst); - sample_profile -} - -/// Converts an ELF object identifier into a `DebugId`. -/// -/// The identifier data is first truncated or extended to match 16 byte size of -/// Uuids. If the data is declared in little endian, the first three Uuid fields -/// are flipped to match the big endian expected by the breakpad processor. -/// -/// The `DebugId::appendix` field is always `0` for ELF. -fn debug_id_from_build_id(build_id: &[u8]) -> Option { - const UUID_SIZE: usize = 16; - let mut data = [0u8; UUID_SIZE]; - let len = build_id.len().min(UUID_SIZE); - data[0..len].copy_from_slice(&build_id[0..len]); - - #[cfg(target_endian = "little")] - { - // The ELF file targets a little endian architecture. Convert to - // network byte order (big endian) to match the Breakpad processor's - // expectations. For big endian object files, this is not needed. - data[0..4].reverse(); // uuid field 1 - data[4..6].reverse(); // uuid field 2 - data[6..8].reverse(); // uuid field 3 - } - - Uuid::from_slice(&data).map(DebugId::from_uuid).ok() -} - -pub fn debug_images() -> Vec { - let mut images = vec![]; - if !TARGET_SUPPORTED { - return images; - } - - //crate:: ::{CodeId, DebugId, Uuid}; - TargetSharedLibrary::each(|shlib| { - let maybe_debug_id = shlib.debug_id().and_then(|id| match id { - SharedLibraryId::Uuid(bytes) => Some(DebugId::from_uuid(Uuid::from_bytes(bytes))), - SharedLibraryId::GnuBuildId(ref id) => debug_id_from_build_id(id), - SharedLibraryId::PdbSignature(guid, age) => DebugId::from_guid_age(&guid, age).ok(), - _ => None, - }); - - let debug_id = match maybe_debug_id { - Some(debug_id) => debug_id, - None => return, - }; - - let mut name = shlib.name().to_string_lossy().to_string(); - if name.is_empty() { - name = std::env::current_exe() - .map(|x| x.display().to_string()) - .unwrap_or_else(|_| "
".to_string()); - } - - let code_id = shlib.id().map(|id| CodeId::new(id.to_string())); - let debug_name = shlib.debug_name().map(|n| n.to_string_lossy().to_string()); - - // For windows, the `virtual_memory_bias` actually returns the real - // `module_base`, which is the address that sentry uses for symbolication. - // Going via the segments means that the `image_addr` would be offset in - // a way that symbolication yields wrong results. - let (image_addr, image_vmaddr) = if cfg!(windows) { - (shlib.virtual_memory_bias().0.into(), 0.into()) - } else { - ( - shlib.actual_load_addr().0.into(), - shlib.stated_load_addr().0.into(), - ) - }; - - images.push( - SymbolicDebugImage { - id: debug_id, - name, - arch: None, - image_addr, - image_size: shlib.len() as u64, - image_vmaddr, - code_id, - debug_file: debug_name, - } - .into(), - ); - }); - - images -} - -fn get_profile_from_report( - rep: &pprof::UnresolvedReport, - trace_id: TraceId, - transaction: &Transaction, -) -> SampleProfile { - let mut samples: Vec = Vec::with_capacity(rep.data.len()); - let mut stacks: Vec> = Vec::with_capacity(rep.data.len()); - let mut address_to_frame_idx: IndexSet<_> = IndexSet::new(); - let mut thread_metadata: HashMap = HashMap::new(); - // map form thread id to number of samples for that thread - let mut thread_samples: HashMap = HashMap::new(); - - for sample in rep.data.keys() { - let stack = sample - .frames - .iter() - .map(|frame| { - #[cfg(feature = "frame-pointer")] - let instruction_addr = frame.ip as *mut core::ffi::c_void; - #[cfg(not(feature = "frame-pointer"))] - let instruction_addr = frame.ip(); - - address_to_frame_idx.insert_full(instruction_addr).0 as u32 - }) - .collect(); - - stacks.push(stack); - samples.push(Sample { - stack_id: (stacks.len() - 1) as u32, - thread_id: sample.thread_id, - elapsed_since_start_ns: sample - .sample_timestamp - .duration_since(transaction.start_timestamp) - .unwrap() - .as_nanos() as u64, - }); - - thread_samples - .entry(sample.thread_id) - .and_modify(|count| *count += 1) - .or_insert(1); - - thread_metadata - .entry(sample.thread_id.to_string()) - .or_insert(ThreadMetadata { - name: Some( - String::from_utf8_lossy(&sample.thread_name[0..sample.thread_name_length]) - .into_owned(), - ), - }); - } - - samples.retain(|s| thread_samples.get(&s.thread_id).unwrap() > &1); - - SampleProfile { - version: Version::V1, - debug_meta: Some(DebugMeta { - sdk_info: None, - images: debug_images(), - }), - device: DeviceMetadata { - architecture: Some(std::env::consts::ARCH.to_string()), - }, - os: OSMetadata { - name: sys_info::os_type().unwrap(), - version: sys_info::os_release().unwrap(), - build_number: None, - }, - runtime: Some(RuntimeMetadata { - name: "rustc".to_string(), - version: rustc_version_runtime::version().to_string(), - }), - environment: match &transaction.environment { - Some(env) => env.to_string(), - _ => "".to_string(), - }, - - event_id: uuid::Uuid::new_v4(), - release: transaction.release.clone().unwrap_or_default().into(), - timestamp: transaction.start_timestamp, - transaction: TransactionMetadata { - id: transaction.event_id, - name: transaction.name.clone().unwrap_or_default(), - trace_id, - active_thread_id: transaction.active_thread_id.unwrap_or(0), - }, - platform: "rust".to_string(), - profile: Profile { - samples, - stacks, - frames: address_to_frame_idx - .into_iter() - .map(|address| -> RustFrame { - RustFrame { - instruction_addr: format!("{address:p}"), - } - }) - .collect(), - thread_metadata, - }, - } -} diff --git a/sentry-types/src/protocol/envelope.rs b/sentry-types/src/protocol/envelope.rs index 7815c855..f8de5b9a 100644 --- a/sentry-types/src/protocol/envelope.rs +++ b/sentry-types/src/protocol/envelope.rs @@ -5,8 +5,8 @@ use thiserror::Error; use uuid::Uuid; use super::v7::{ - Attachment, AttachmentType, Event, MonitorCheckIn, SampleProfile, SessionAggregates, - SessionUpdate, Transaction, + Attachment, AttachmentType, Event, MonitorCheckIn, SessionAggregates, SessionUpdate, + Transaction, }; /// Raised if a envelope cannot be parsed from a given input. @@ -58,9 +58,6 @@ enum EnvelopeItemType { /// An Attachment Item type. #[serde(rename = "attachment")] Attachment, - /// A Profile Item Type - #[serde(rename = "profile")] - Profile, /// A Monitor Check In Item Type #[serde(rename = "check_in")] MonitorCheckIn, @@ -110,8 +107,6 @@ pub enum EnvelopeItem { /// See the [Attachment Item documentation](https://develop.sentry.dev/sdk/envelopes/#attachment) /// for more details. Attachment(Attachment), - /// A Profile Item. - Profile(SampleProfile), /// A MonitorCheckIn item. MonitorCheckIn(MonitorCheckIn), /// This is a sentinel item used to `filter` raw envelopes. @@ -150,12 +145,6 @@ impl From for EnvelopeItem { } } -impl From for EnvelopeItem { - fn from(profile: SampleProfile) -> Self { - EnvelopeItem::Profile(profile) - } -} - impl From for EnvelopeItem { fn from(check_in: MonitorCheckIn) -> Self { EnvelopeItem::MonitorCheckIn(check_in) @@ -351,7 +340,6 @@ impl Envelope { writeln!(writer)?; continue; } - EnvelopeItem::Profile(profile) => serde_json::to_writer(&mut item_buf, profile)?, EnvelopeItem::MonitorCheckIn(check_in) => { serde_json::to_writer(&mut item_buf, check_in)? } @@ -365,7 +353,6 @@ impl Envelope { EnvelopeItem::SessionAggregates(_) => "sessions", EnvelopeItem::Transaction(_) => "transaction", EnvelopeItem::Attachment(_) | EnvelopeItem::Raw => unreachable!(), - EnvelopeItem::Profile(_) => "profile", EnvelopeItem::MonitorCheckIn(_) => "check_in", }; writeln!( @@ -507,7 +494,6 @@ impl Envelope { content_type: header.content_type, ty: header.attachment_type, })), - EnvelopeItemType::Profile => serde_json::from_slice(payload).map(EnvelopeItem::Profile), EnvelopeItemType::MonitorCheckIn => { serde_json::from_slice(payload).map(EnvelopeItem::MonitorCheckIn) } diff --git a/sentry-types/src/protocol/mod.rs b/sentry-types/src/protocol/mod.rs index cdb35d0a..bf0d8977 100644 --- a/sentry-types/src/protocol/mod.rs +++ b/sentry-types/src/protocol/mod.rs @@ -16,5 +16,4 @@ pub use v7 as latest; mod attachment; mod envelope; mod monitor; -mod profile; mod session; diff --git a/sentry-types/src/protocol/profile.rs b/sentry-types/src/protocol/profile.rs deleted file mode 100644 index 8355ae57..00000000 --- a/sentry-types/src/protocol/profile.rs +++ /dev/null @@ -1,139 +0,0 @@ -use std::{collections::HashMap, time::SystemTime}; - -use super::v7::{DebugMeta, TraceId}; -use crate::utils::ts_rfc3339; - -use serde::{Deserialize, Serialize, Serializer}; -use uuid::Uuid; - -fn serialize_id(uuid: &Uuid, serializer: S) -> Result { - serializer.serialize_some(&uuid.as_simple()) -} -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Metadata about the transaction associated with the profile -pub struct TransactionMetadata { - #[serde(serialize_with = "serialize_id")] - /// Transaction ID - pub id: Uuid, - /// Transaction Name - pub name: String, - /// Trace ID - pub trace_id: TraceId, - /// ID of the thread in which the transaction started - #[serde(default)] - pub active_thread_id: u64, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq, Hash)] -/// Single frame of a Sample -pub struct RustFrame { - /// Instruction address - pub instruction_addr: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Single sample of a profile -pub struct Sample { - /// ID of the relative stack - pub stack_id: u32, - /// Thread ID - pub thread_id: u64, - /// Timestamp at which this sample was collected relative to the start of the profiler - pub elapsed_since_start_ns: u64, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Thread metadata -pub struct ThreadMetadata { - #[serde(default, skip_serializing_if = "Option::is_none")] - /// Thread name - pub name: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Collected Profile -pub struct Profile { - /// list of samples in a profile - pub samples: Vec, - /// List of stacks: each stacks is a vec of indexed frames - pub stacks: Vec>, - /// List of frames - pub frames: Vec, - /// Thread metadata - pub thread_metadata: HashMap, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Operating System metadata -pub struct OSMetadata { - /// OS Name - pub name: String, - /// OS Version - pub version: String, - - #[serde(default, skip_serializing_if = "Option::is_none")] - /// Build number - pub build_number: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Runtime metadata -pub struct RuntimeMetadata { - /// Runtime name (rustc) - pub name: String, - /// Runtime version - pub version: String, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Device metadata -pub struct DeviceMetadata { - /// Architecture - pub architecture: Option, -} - -#[derive(Debug, Serialize, Deserialize, Clone, Eq, PartialEq)] -/// Profile format version -pub enum Version { - #[serde(rename = "1")] - /// First version - V1, -} - -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] -/// Represents a Profile Envelope ItemType -pub struct SampleProfile { - /// Format version of the SampleProfile - pub version: Version, - - #[serde(skip_serializing_if = "Option::is_none")] - /// Debug meta information - pub debug_meta: Option, - - /// Device metadata information - pub device: DeviceMetadata, - /// OS metadata information - pub os: OSMetadata, - #[serde(skip_serializing_if = "Option::is_none")] - /// Runtime metadata information - pub runtime: Option, - - #[serde(default, skip_serializing_if = "String::is_empty")] - /// Environment - pub environment: String, - #[serde(serialize_with = "serialize_id")] - /// Event ID or Profile ID - pub event_id: Uuid, - /// Platform - pub platform: String, - /// Collected profile - pub profile: Profile, - /// Release - pub release: String, - #[serde(with = "ts_rfc3339")] - /// Timestamp at which the profiler started - pub timestamp: SystemTime, - - /// Transaction associated with this profile - pub transaction: TransactionMetadata, -} diff --git a/sentry-types/src/protocol/v7.rs b/sentry-types/src/protocol/v7.rs index a8213441..71863e60 100644 --- a/sentry-types/src/protocol/v7.rs +++ b/sentry-types/src/protocol/v7.rs @@ -26,7 +26,6 @@ use crate::utils::{ts_rfc3339_opt, ts_seconds_float}; pub use super::attachment::*; pub use super::envelope::*; pub use super::monitor::*; -pub use super::profile::*; pub use super::session::*; /// An arbitrary (JSON) value. @@ -1098,8 +1097,6 @@ pub enum Context { Trace(Box), /// GPU data Gpu(Box), - /// Profiling data - Profile(Box), /// Generic other context data. #[serde(rename = "unknown")] Other(Map), @@ -1116,7 +1113,6 @@ impl Context { Context::Browser(..) => "browser", Context::Trace(..) => "trace", Context::Gpu(..) => "gpu", - Context::Profile(..) => "profile", Context::Other(..) => "unknown", } } @@ -1335,13 +1331,6 @@ pub struct GpuContext { pub other: Map, } -/// Profile context. -#[derive(Serialize, Deserialize, Debug, Clone, Default, PartialEq)] -pub struct ProfileContext { - /// The profile ID. - pub profile_id: Uuid, -} - /// Holds the identifier for a Span #[derive(Serialize, Deserialize, Debug, Copy, Clone, Eq, PartialEq, Hash)] #[serde(try_from = "String", into = "String")] @@ -1474,11 +1463,8 @@ into_context!(Runtime, RuntimeContext); into_context!(Browser, BrowserContext); into_context!(Trace, TraceContext); into_context!(Gpu, GpuContext); -into_context!(Profile, ProfileContext); -const INFERABLE_CONTEXTS: &[&str] = &[ - "device", "os", "runtime", "app", "browser", "trace", "gpu", "profile", -]; +const INFERABLE_CONTEXTS: &[&str] = &["device", "os", "runtime", "app", "browser", "trace", "gpu"]; struct ContextsVisitor; @@ -2009,9 +1995,6 @@ pub struct Transaction<'a> { /// Optionally HTTP request data to be sent along. #[serde(default, skip_serializing_if = "Option::is_none")] pub request: Option, - /// ID of the thread where the transaction was started - #[serde(default, skip_serializing_if = "Option::is_none")] - pub active_thread_id: Option, } impl<'a> Default for Transaction<'a> { @@ -2030,7 +2013,6 @@ impl<'a> Default for Transaction<'a> { spans: Default::default(), contexts: Default::default(), request: Default::default(), - active_thread_id: Default::default(), } } } @@ -2057,7 +2039,6 @@ impl<'a> Transaction<'a> { spans: self.spans, contexts: self.contexts, request: self.request, - active_thread_id: self.active_thread_id, } } diff --git a/sentry/Cargo.toml b/sentry/Cargo.toml index 0bc990e2..6d6de6f9 100644 --- a/sentry/Cargo.toml +++ b/sentry/Cargo.toml @@ -36,8 +36,6 @@ tower = ["sentry-tower"] tower-http = ["tower", "sentry-tower/http"] tower-axum-matched-path = ["tower-http", "sentry-tower/axum-matched-path"] tracing = ["sentry-tracing"] -profiling = ["sentry-core/profiling"] -frame-pointer = ["sentry-core/frame-pointer"] # other features test = ["sentry-core/test"] debug-logs = ["dep:log", "sentry-core/debug-logs"] diff --git a/sentry/src/transports/ratelimit.rs b/sentry/src/transports/ratelimit.rs index e419f999..0aa36bb7 100644 --- a/sentry/src/transports/ratelimit.rs +++ b/sentry/src/transports/ratelimit.rs @@ -12,7 +12,6 @@ pub struct RateLimiter { session: Option, transaction: Option, attachment: Option, - profile: Option, } impl RateLimiter { @@ -57,7 +56,6 @@ impl RateLimiter { "session" => self.session = new_time, "transaction" => self.transaction = new_time, "attachment" => self.attachment = new_time, - "profile" => self.profile = new_time, _ => {} } } @@ -91,7 +89,6 @@ impl RateLimiter { RateLimitingCategory::Session => self.session, RateLimitingCategory::Transaction => self.transaction, RateLimitingCategory::Attachment => self.attachment, - RateLimitingCategory::Profile => self.profile, }?; time_left.duration_since(SystemTime::now()).ok() } @@ -115,7 +112,6 @@ impl RateLimiter { } EnvelopeItem::Transaction(_) => RateLimitingCategory::Transaction, EnvelopeItem::Attachment(_) => RateLimitingCategory::Attachment, - EnvelopeItem::Profile(_) => RateLimitingCategory::Profile, _ => RateLimitingCategory::Any, }) }) @@ -135,8 +131,6 @@ pub enum RateLimitingCategory { Transaction, /// Rate Limit pertaining to Attachments. Attachment, - /// Rate Limit pertaining to Profiles. - Profile, } #[cfg(test)]