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-987 Add scrubbing API to DatadogObjc #383

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

ncreated
Copy link
Member

What and why?

📦 Based on RUM @objc models generated in #382, this PR adds Scrubbing APIs to DatadogObjc:

// in DDConfigurationBuilder:

@objc
public func setRUMViewEventMapper(_ mapper: @escaping (DDRUMViewEvent) -> DDRUMViewEvent?)

@objc
public func setRUMResourceEventMapper(_ mapper: @escaping (DDRUMResourceEvent) -> DDRUMResourceEvent?)

@objc
public func setRUMActionEventMapper(_ mapper: @escaping (DDRUMActionEvent) -> DDRUMActionEvent?)

@objc
public func setRUMErrorEventMapper(_ mapper: @escaping (DDRUMErrorEvent) -> DDRUMErrorEvent?)

How?

As usual, DatadogObjc APIs bridge their calls to Datadog (Swift).

I also made sure those APIs are properly exposed, compile and look "nice" in Objective-c. Here, an example of redacting the resource.url for POST resources and dropping all other resources:

[builder setRUMResourceEventMapper:^DDRUMResourceEvent * _Nullable(DDRUMResourceEvent * _Nonnull event) {
    if (event.resource.method == DDRUMResourceEventResourceRUMMethodPost) {
        event.resource.url = @"redacted";
        return event;
    } else {
        return nil;
    }
}];

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 26, 2021 12:32
@ncreated ncreated self-assigned this Jan 26, 2021
Copy link
Contributor

@acgh acgh left a comment

Choose a reason for hiding this comment

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

That's quite straightforward thanks to your previous PR #382 👏

Base automatically changed from ncreated/RUMM-987-expose-scrubbing-API-for-objc to master January 26, 2021 16:25
@ncreated ncreated merged commit aa27e84 into master Jan 27, 2021
@ncreated ncreated deleted the ncreated/RUMM-987-expose-scrubbing-API-in-Objc branch January 27, 2021 10:22
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