Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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