Skip to content

Commit

Permalink
ref(metrics): remove features and code related to the old metrics beta (
Browse files Browse the repository at this point in the history
#740)

* ref(metrics): remove features and code related to the old metrics beta

* remove statsd thing
  • Loading branch information
lcian authored Feb 13, 2025
1 parent e1fc510 commit 1ea3664
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 2,066 deletions.
2 changes: 0 additions & 2 deletions sentry-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ client = ["rand"]
# and macros actually expand features (and extern crate) where they are used!
debug-logs = ["dep:log"]
test = ["client"]
metrics = ["sentry-types/metrics", "regex", "crc32fast"]
metrics-cadence1 = ["dep:cadence", "metrics"]

[dependencies]
cadence = { version = "1.4.0", optional = true }
Expand Down
163 changes: 0 additions & 163 deletions sentry-core/src/cadence.rs

This file was deleted.

31 changes: 0 additions & 31 deletions sentry-core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use sentry_types::protocol::v7::SessionUpdate;
use sentry_types::random_uuid;

use crate::constants::SDK_INFO;
#[cfg(feature = "metrics")]
use crate::metrics::{self, MetricAggregator};
use crate::protocol::{ClientSdkInfo, Event};
use crate::session::SessionFlusher;
use crate::types::{Dsn, Uuid};
Expand Down Expand Up @@ -46,8 +44,6 @@ pub struct Client {
options: ClientOptions,
transport: TransportArc,
session_flusher: RwLock<Option<SessionFlusher>>,
#[cfg(feature = "metrics")]
metric_aggregator: RwLock<Option<MetricAggregator>>,
integrations: Vec<(TypeId, Arc<dyn Integration>)>,
pub(crate) sdk_info: ClientSdkInfo,
}
Expand All @@ -68,17 +64,10 @@ impl Clone for Client {
transport.clone(),
self.options.session_mode,
)));
#[cfg(feature = "metrics")]
let metric_aggregator = RwLock::new(Some(MetricAggregator::new(
transport.clone(),
&self.options,
)));
Client {
options: self.options.clone(),
transport,
session_flusher,
#[cfg(feature = "metrics")]
metric_aggregator,
integrations: self.integrations.clone(),
sdk_info: self.sdk_info.clone(),
}
Expand Down Expand Up @@ -147,16 +136,10 @@ impl Client {
options.session_mode,
)));

#[cfg(feature = "metrics")]
let metric_aggregator =
RwLock::new(Some(MetricAggregator::new(transport.clone(), &options)));

Client {
options,
transport,
session_flusher,
#[cfg(feature = "metrics")]
metric_aggregator,
integrations,
sdk_info,
}
Expand Down Expand Up @@ -323,23 +306,11 @@ impl Client {
}
}

/// Captures a metric and sends it to Sentry on the next flush.
#[cfg(feature = "metrics")]
pub fn add_metric(&self, metric: metrics::Metric) {
if let Some(ref aggregator) = *self.metric_aggregator.read().unwrap() {
aggregator.add(metric)
}
}

/// Drains all pending events without shutting down.
pub fn flush(&self, timeout: Option<Duration>) -> bool {
if let Some(ref flusher) = *self.session_flusher.read().unwrap() {
flusher.flush();
}
#[cfg(feature = "metrics")]
if let Some(ref aggregator) = *self.metric_aggregator.read().unwrap() {
aggregator.flush();
}
if let Some(ref transport) = *self.transport.read().unwrap() {
transport.flush(timeout.unwrap_or(self.options.shutdown_timeout))
} else {
Expand All @@ -356,8 +327,6 @@ impl Client {
/// `shutdown_timeout` in the client options.
pub fn close(&self, timeout: Option<Duration>) -> bool {
drop(self.session_flusher.write().unwrap().take());
#[cfg(feature = "metrics")]
drop(self.metric_aggregator.write().unwrap().take());
let transport_opt = self.transport.write().unwrap().take();
if let Some(transport) = transport_opt {
sentry_debug!("client close; request transport to shut down");
Expand Down
6 changes: 0 additions & 6 deletions sentry-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,13 @@ pub use crate::performance::*;
pub use crate::scope::{Scope, ScopeGuard};
pub use crate::transport::{Transport, TransportFactory};

#[cfg(all(feature = "client", feature = "metrics-cadence1"))]
pub mod cadence;
// client feature
#[cfg(feature = "client")]
mod client;
#[cfg(feature = "client")]
mod hub_impl;
#[cfg(all(feature = "client", feature = "metrics"))]
pub mod metrics;
#[cfg(feature = "client")]
mod session;
#[cfg(all(feature = "client", feature = "metrics"))]
mod units;

#[cfg(feature = "client")]
pub use crate::{client::Client, hub_impl::SwitchGuard as HubSwitchGuard};
Expand Down
Loading

0 comments on commit 1ea3664

Please sign in to comment.