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

feat(normalization): Scrub span description URLs #2095

Merged
merged 10 commits into from
May 8, 2023

Conversation

iker-barriocanal
Copy link
Contributor

@iker-barriocanal iker-barriocanal commented May 4, 2023

Scrub identifiers from URLs in span description. The scrubbed description is available in the span as data['description.scrubbed'], and in case something was scrubbed, a span.description tag is added to span metrics. This only happens to these projects with the feature flag enabled.

@iker-barriocanal iker-barriocanal self-assigned this May 4, 2023
@iker-barriocanal iker-barriocanal changed the title feat(spans): Scrub span description URLs feat(normalization): Scrub span description URLs May 5, 2023
@iker-barriocanal iker-barriocanal marked this pull request as ready for review May 5, 2023 09:38
@iker-barriocanal iker-barriocanal requested a review from a team May 5, 2023 09:38
.and_then(|data| {
data.insert(
"description.scrubbed".to_owned(),
Annotated::new(Value::String(new_desc.to_owned())),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having some issues to add the scrubbed description as the value here, and the dance around scrubbed values above is a result of this.

.unwrap();

assert_eq!($input, span.value().unwrap().description.value().unwrap());
if $output == "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, this is Option::None, I'll address this in a future PR.

relay-general/src/store/transactions/processor.rs Outdated Show resolved Hide resolved
relay-general/src/store/transactions/processor.rs Outdated Show resolved Hide resolved
@iker-barriocanal iker-barriocanal merged commit 6e48f70 into master May 8, 2023
@iker-barriocanal iker-barriocanal deleted the iker/feat/parameterize-span-desc-uuids branch May 8, 2023 13:55

if let Some(is_url_like) = span.op.value().map(|op| op.starts_with("http")) {
if is_url_like && scrub_identifiers(&mut scrubbed)? {
let Some(new_desc) = scrubbed.value() else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could use .into_value() here instead of the .value(), since it would give the the Option<String> and there won't be any need to to new_desc.to_owned() where you allocate another string again on line 476

jan-auer added a commit that referenced this pull request May 9, 2023
* master: (178 commits)
  ref(crons): Allow `_` in monitor slugs (#2100)
  fix(span-metrics): Scrub subdomains in metric tags (#2103)
  feat(normalization): Scrub span description URLs (#2095)
  feat(dynamic-sampling): Add possibility to run dynamic sampling from `sentry-relay` (#2091)
  ref(dynamic-config): Remove transaction metrics allowlist from Sentry (#2092)
  feat(protocol): Support old effective-directory format (#2048)
  ref(spans): Add more tags to span metrics (#2090)
  fix(server): Support HTTP half-close connections (#2089)
  ref(spans): Use transactions namespace with `span` prefix (#2087)
  ref(spans): Update span metrics feature flag name (#2086)
  feat(metrics): Extract more metrics from spans (#2080)
  build: Bump tempfile to remove flagged dependency (#2085)
  feat(filter): Add document_uri csp filter (#2059)
  build: Use jemalloc on Linux (#2084)
  ci(gha): add debugging for "Couldn'\''t write tracker file" issue (#2081)
  feat(crons): Pass-through minimal `sdk` field (#2073)
  fix(quota): Parse large limits (#2079)
  instr(server): More details on unexpected envelope drop (#2077)
  fix(ci): Skip flaky integration test (#2076)
  feat(dynamic-sampling): Add support for `trace.replay_id` in matching rules (#2070)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants