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

chore(metrics): Remove support for extrapolation #3969

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 0 additions & 13 deletions relay-dynamic-config/src/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,6 @@ pub struct Options {
)]
pub span_extraction_sample_rate: Option<f32>,

/// The maximum duplication factor used to extrapolate distribution metrics from sampled data.
///
/// This applies as long as Relay duplicates distribution values to extrapolate. The default is
/// `0`, which disables extrapolation of distributions completely. This option does not apply to
/// any other metric types.
#[serde(
default,
rename = "sentry-metrics.extrapolation.duplication-limit",
deserialize_with = "default_on_error",
skip_serializing_if = "is_default"
)]
pub extrapolation_duplication_limit: usize,

/// List of values on span description that are allowed to be sent to Sentry without being scrubbed.
///
/// At this point, it doesn't accept IP addresses in CIDR format.. yet.
Expand Down
57 changes: 0 additions & 57 deletions relay-dynamic-config/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ pub struct MetricExtractionConfig {
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub tags: Vec<TagMapping>,

/// Extrapolation for metrics extracted from sampled data.
#[serde(default, skip_serializing_if = "ExtrapolationConfig::is_empty")]
pub extrapolate: ExtrapolationConfig,

/// This config has been extended with fields from `conditional_tagging`.
///
/// At the moment, Relay will parse `conditional_tagging` rules and insert them into the `tags`
Expand Down Expand Up @@ -343,7 +339,6 @@ impl MetricExtractionConfig {
global_groups: BTreeMap::new(),
metrics: Default::default(),
tags: Default::default(),
extrapolate: Default::default(),
_conditional_tags_extended: false,
_span_metrics_extended: false,
}
Expand Down Expand Up @@ -643,39 +638,6 @@ pub fn convert_conditional_tagging(project_config: &mut ProjectConfig) {
}
}

/// Configuration for metric extrapolation from sampled data.
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ExtrapolationConfig {
/// A list of MRI glob patterns to include in extrapolation.
#[serde(default)]
pub include: Vec<LazyGlob>,

/// A list of MRI glob patterns to exclude from extrapolation, overriding inclusion.
#[serde(default)]
pub exclude: Vec<LazyGlob>,
}

impl ExtrapolationConfig {
/// Returns `true` if this config is empty.
pub fn is_empty(&self) -> bool {
self.include.is_empty()
}

/// Returns `true` if the given metric resource identifier matches the include and exclude
/// patterns.
pub fn matches(&self, mri: &str) -> bool {
!self
.exclude
.iter()
.any(|glob| glob.compiled().is_match(mri))
&& self
.include
.iter()
.any(|glob| glob.compiled().is_match(mri))
}
}

struct TaggingRuleConverter<I: Iterator<Item = TaggingRule>> {
rules: std::iter::Peekable<I>,
tags: Vec<TagSpec>,
Expand Down Expand Up @@ -854,23 +816,4 @@ mod tests {
vec!["tag1"]
);
}

#[test]
fn test_extrapolation() {
let json = serde_json::json!({
"version": 1,
"extrapolate": {
"include": ["?:transactions/*", "?:spans/*", "?:custom/*"],
"exclude": ["c:spans/usage@none", "c:transactions/usage@none", "c:transactions/count_per_root_project@none"]
}
});

let config: MetricExtractionConfig = serde_json::from_value(json).unwrap();
let extrapolate = config.extrapolate;

assert!(!extrapolate.is_empty());
assert!(extrapolate.matches("d:custom/foo@none"));
assert!(extrapolate.matches("d:spans/foo@none"));
assert!(!extrapolate.matches("c:spans/usage@none"));
}
}
Loading
Loading