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-1582 Fix DDRUMView and DDRUMAction APIs for Objective-C #583

Conversation

ncreated
Copy link
Member

@ncreated ncreated commented Sep 1, 2021

What and why?

🐞 As noticed in #577 (comment), DDRUMView and DDRUMAction were not properly exposed to Objective-C interface.

This PR targets the 1.7.0-beta4 branch, as IMO this is no-risk but high impact fix that can be shipped in 1.7.0.

How?

Swift definitions of DDRUMView and DDRUMAction were missing @objc annotation in their public init(). Definition for DDRUMView was there, but it was accidentally removed in this refactoring.

Objective-C API tests

Because unexposed or broken Objective-C APIs are recurring problem (#359, #360, #461) I did an improvement to our DatadogObjc unit tests by adding smoke tests covering the public interface in Objective-C, e.g.:

// DDConfiguration+apiTests.m

- (void)testDDConfigurationBuilderAPI {
    DDConfigurationBuilder *builder = [DDConfiguration builderWithClientToken:@"" environment:@""];
    // ...
    [builder trackUIKitRUMViews];
    [builder trackUIKitRUMViewsUsing:[CustomDDUIKitRUMViewsPredicate new]];
    [builder setRUMViewEventMapper:^DDRUMViewEvent * _Nonnull(DDRUMViewEvent * _Nonnull viewEvent) {
        viewEvent.view.url = @"";
        return viewEvent;
    }];
    // ...
    [builder setWithBatchSize:DDBatchSizeMedium];
    [builder build];
}

From now on, when we expose a new API in DatadogObjc, we can preview its Objective-C representation right in the test file. Adding test would prevent regression on eventual refactoring and ensure that the API is exposed properly.

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 September 1, 2021 14:51
@ncreated ncreated self-assigned this Sep 1, 2021
Copy link
Member

@maxep maxep left a comment

Choose a reason for hiding this comment

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

Looks good! I trust you on the API coverage in the smoke tests :)

@ncreated
Copy link
Member Author

ncreated commented Sep 2, 2021

Looks good! I trust you on the API coverage in the smoke tests :)

Actually, I only covered SDK configuration and RUM instrumentation APIs. This is already a lot and with Logging and Tracing being quite old features, IMO we can consider it good for now. I also created RUMM-1586 where we can add missing coverage for Logging and Tracing and think of solution / automation for ensuring that new APIs are always covered.

@ncreated ncreated merged commit 772d09b into release/1.7.0-beta4 Sep 2, 2021
@ncreated ncreated deleted the ncreated/RUMM-1582-expose-missing-RUMView-APIs-to-Objc branch September 2, 2021 09:50
@ncreated ncreated mentioned this pull request Nov 9, 2022
6 tasks
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