Skip to content

Commit

Permalink
Merge branch 'master' into ref/remove-actix-connector
Browse files Browse the repository at this point in the history
* master:
  ref(breakdowns): All fields in breakdown config should be camelCase, and rename the breakdown key name in project options. (#1020)
  • Loading branch information
jan-auer committed Jun 17, 2021
2 parents 0c519c0 + 9fd1a43 commit 5001924
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Changelog

## 21.6.1
## Unreleased

**Internal**:

- All fields in breakdown config should be camelCase, and rename the breakdown key name in project options. ([#1020](https://github.com/getsentry/relay/pull/1020))

**Bug Fixes**:

- Remove connection metrics reported under `connector.*`. They have been fully disabled since version `21.3.0`. ([#1021](https://github.com/getsentry/relay/pull/1021))

## 21.6.1

- No documented changes.

## 21.6.0

**Features**:
Expand Down
8 changes: 6 additions & 2 deletions relay-general/src/store/normalize/breakdowns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pub trait EmitBreakdowns {

/// Configuration to define breakdowns based on span operation name.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(rename_all = "camelCase")]
pub struct SpanOperationsConfig {
/// Operation names are matched against an array of strings. The match is successful if the span
/// operation name starts with any string in the array. If any string in the array has at least
Expand Down Expand Up @@ -202,15 +202,19 @@ impl EmitBreakdowns for SpanOperationsConfig {

/// Configuration to define breakdown to be generated based on properties and breakdown type.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
#[serde(tag = "type", rename_all = "camelCase")]
pub enum BreakdownConfig {
#[serde(alias = "span_operations")]
SpanOperations(SpanOperationsConfig),
#[serde(other)]
Unsupported,
}

impl EmitBreakdowns for BreakdownConfig {
fn emit_breakdowns(&self, event: &Event) -> Option<Measurements> {
match self {
BreakdownConfig::SpanOperations(config) => config.emit_breakdowns(event),
BreakdownConfig::Unsupported => None,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion relay-server/src/actors/envelopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ impl EnvelopeProcessor {
normalize_user_agent: Some(true),
sent_at: envelope.sent_at(),
received_at: Some(received_at),
breakdowns: project_state.config.breakdowns.clone(),
breakdowns: project_state.config.breakdowns_v2.clone(),
};

let mut store_processor = StoreProcessor::new(store_config, self.geoip_lookup.as_deref());
Expand Down
4 changes: 2 additions & 2 deletions relay-server/src/actors/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub struct ProjectConfig {
pub dynamic_sampling: Option<SamplingConfig>,
/// Configuration for operation breakdown. Will be emitted only if present.
#[serde(skip_serializing_if = "Option::is_none")]
pub breakdowns: Option<BreakdownsConfig>,
pub breakdowns_v2: Option<BreakdownsConfig>,
/// Exposable features enabled for this project
#[serde(skip_serializing_if = "BTreeSet::is_empty")]
pub features: BTreeSet<Feature>,
Expand All @@ -103,7 +103,7 @@ impl Default for ProjectConfig {
event_retention: None,
quotas: Vec::new(),
dynamic_sampling: None,
breakdowns: None,
breakdowns_v2: None,
features: BTreeSet::new(),
}
}
Expand Down
26 changes: 25 additions & 1 deletion tests/integration/test_envelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,41 @@ def test_ops_breakdowns(mini_sentry, relay_with_processing, transactions_consume

relay = relay_with_processing()
config = mini_sentry.add_basic_project_config(42)

config["config"].setdefault(
"breakdowns",
"breakdownsV2",
{
"span_ops": {
"type": "span_operations",
"matches": ["http", "db", "browser", "resource"],
},
"span_ops_2": {
"type": "spanOperations",
"matches": ["http", "db", "browser", "resource"],
},
"span_ops_3": {
"type": "whatever",
"matches": ["http", "db", "browser", "resource"],
},
},
)

config["config"].setdefault(
# old name of span operation breakdown key. we expect these to not generate anything at all
"breakdowns",
{
"span_ops_4": {
"type": "span_operations",
"matches": ["http", "db", "browser", "resource"],
},
"span_ops_5": {
"type": "spanOperations",
"matches": ["http", "db", "browser", "resource"],
},
"span_ops_6": {
"type": "whatever",
"matches": ["http", "db", "browser", "resource"],
},
},
)

Expand Down

0 comments on commit 5001924

Please sign in to comment.