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-788 Add data scrubbing API #367

Merged
merged 5 commits into from
Jan 14, 2021

Conversation

ncreated
Copy link
Member

What and why?

🚚 This PR adds RUM events scrubbing feature with set of 4 new public APIs:

public func setRUMViewEventMapper(_ mapper: @escaping (RUMViewEvent) -> RUMViewEvent?)
public func setRUMResourceEventMapper(_ mapper: @escaping (RUMResourceEvent) -> RUMResourceEvent?)
public func setRUMActionEventMapper(_ mapper: @escaping (RUMActionEvent) -> RUMActionEvent?)
public func setRUMErrorEventMapper(_ mapper: @escaping (RUMErrorEvent) -> RUMErrorEvent?)

Each API allows the user to inspect and modify RUM events before they get send. Returning nil drops the event.

How?

A basic interface of EventMapper is introduced:

internal protocol EventMapper {
    func map<T: Encodable>(event: T) -> T?
}

and plugged into DataProcessor's pipeline, just before writing the event to the file.

It is implemented by RUMEventsMapper which intercepts each value using closures configured by the user in the public interface.

In the next PR I will also add test scenario to Example application with the integration test for scrubbing API.

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 January 12, 2021 16:28
@ncreated ncreated self-assigned this Jan 12, 2021
Base automatically changed from ncreated/RUMM-788-prepare-RUM-models-for-data-scrubbing to master January 14, 2021 08:34
@ncreated ncreated force-pushed the ncreated/RUMM-788-add-data-scrubbing-api branch from 15e180c to fdf4624 Compare January 14, 2021 12:28
)
)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use model generator to create these mocks too?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking of this, but it took me ~10 min to do it by hand, while adding this in rum-models-generator would be at least few hours. Let's see how difficult would it be to maintain this hand-made mocks, if too expensive, we can invest our time in rum-models-generator 👌.

@ncreated ncreated merged commit 119329d into master Jan 14, 2021
@ncreated ncreated deleted the ncreated/RUMM-788-add-data-scrubbing-api branch January 14, 2021 16:52
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