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

RUMM-1104 Add SpanEvent scrubbing API - implement event mapper #481

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented May 4, 2021

What and why?

📦 This PR adds the actual implementation of SpanEvents scrubbing - the SpanEvents mapper API:

public func setSpanEventMapper(_ mapper: @escaping (SpanEvent) -> SpanEvent)

How?

Similar to how RUM events mapper works, the mapper is set up from public interface and passed to the SpanBuilder through FeaturesConfiguration structure. If the mapper is configured, the builder asks it for redacted version of the SpanEvent.

This required making SpanEvent public along with some of its dependencies (notably NetworkConnectionInfo and CarrierInfo).

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference

@ncreated ncreated requested a review from a team as a code owner May 4, 2021 15:21
@ncreated ncreated self-assigned this May 4, 2021
/// The equatabiliity is determined based on comparing type mirrors and values.
protocol EquatableInTests: Equatable {}

extension EquatableInTests {
Copy link
Member Author

Choose a reason for hiding this comment

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

💡 This new implementation of EquatabeInTests is way smarter than the previous one. The old one was just comparing String(describing: lhs) vs String(describing: rhs), which was not working with unordered collections like [String: Encodable] or Set<AnyHashable>. Now, the comparison looks into each value's Mirror and decides on the equality using reflection 👌.

…bbing-for-span-events-part4

RUMM-1104 Add `SpanEvent` scrubbing API - cleanup
@ncreated ncreated merged commit 23e9f4b into ncreated/RUMM-1104-add-data-scrubbing-for-span-events-part2 May 7, 2021
@ncreated ncreated deleted the ncreated/RUMM-1104-add-data-scrubbing-for-span-events-part3 branch May 7, 2021 09:31
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.

2 participants