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-664: Shopist demo runs #225

Merged
merged 3 commits into from
Sep 3, 2020
Merged

RUMM-664: Shopist demo runs #225

merged 3 commits into from
Sep 3, 2020

Conversation

buranmert
Copy link
Contributor

@buranmert buranmert commented Aug 17, 2020

What and why?

We need Shopist app to generate RUM demo data

How?

The app was implemented, this PR implements its UI tests and CI configuration to run them

Also this PR contains linter error fixes in Shopist project
⚠️ In order to make review easier, you can filter "Shopist CI setup is done" commit ⚠️

Visuals

dashboard
Screenshot 2020-08-25 at 11 30 03

CartViewController has resources, traces, actions, errors and logs ✅

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
  • Add more events (eg: user actions, resources, spans) to Shopist app

@buranmert buranmert requested a review from a team as a code owner August 17, 2020 20:16
@buranmert buranmert self-assigned this Aug 17, 2020
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch from 2d6f7d9 to 84c3676 Compare August 17, 2020 20:21
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

What about other Shopist scenarios? I can see at least 6 distinct stories in Android Shopist Demo.

  • There is a TODO left in Shopist.xcconfig:
// TODO: RUMM-664 temporary value, otherwise test cases fail in CI
RUM_APPLICATION_ID=12345 // use your own RUM Application ID obtained on datadoghq.com

Shopist/ShopistUITests/ShopistUITests.swift Outdated Show resolved Hide resolved
Shopist/ShopistUITests/ShopistUITests.swift Outdated Show resolved Hide resolved
Shopist/ShopistUITests/ShopistUITests.swift Outdated Show resolved Hide resolved
Shopist/Makefile Outdated Show resolved Hide resolved
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch 2 times, most recently from 52694bf to 9e6cba9 Compare August 18, 2020 13:05
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch from 9e6cba9 to e8e5675 Compare August 19, 2020 16:55
@buranmert buranmert marked this pull request as draft August 19, 2020 16:58
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch 5 times, most recently from 9601551 to c59efc8 Compare August 20, 2020 09:46
@buranmert buranmert marked this pull request as ready for review August 20, 2020 09:46
@buranmert
Copy link
Contributor Author

buranmert commented Aug 20, 2020

as one last thing i'm trying to add fake computeCart spans to the app
apart from that, every page has user actions, resources and random errors now

computeCart spans are added ✅

@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch 7 times, most recently from 0d00100 to 7c2ebd3 Compare August 21, 2020 15:16
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

Can't review more, as this branch doesn't build:

Screenshot 2020-08-24 at 12 02 15]

Changing the PR to "draft".

Shopist/Shopist/API.swift Show resolved Hide resolved
Shopist/Shopist/API.swift Outdated Show resolved Hide resolved
Shopist/Shopist/API.swift Outdated Show resolved Hide resolved
Shopist/Shopist/Extensions/UIImageView+Network.swift Outdated Show resolved Hide resolved
@ncreated ncreated marked this pull request as draft August 24, 2020 10:03
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch 4 times, most recently from a9af852 to 41f9c3b Compare August 24, 2020 13:54
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch from 41f9c3b to e69ab29 Compare August 24, 2020 13:56
@buranmert buranmert marked this pull request as ready for review August 24, 2020 13:56
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch from e69ab29 to fe00b1a Compare August 25, 2020 09:23
@buranmert buranmert marked this pull request as draft August 25, 2020 11:47
@buranmert buranmert force-pushed the buranmert/RUMM-664-shopist-ci branch 10 times, most recently from c495993 to 19f5911 Compare August 31, 2020 18:19
@buranmert buranmert marked this pull request as ready for review September 1, 2020 10:00
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

Few inline feedbacks and two questions:

  • what about the IP randomization? I think we need a JIRA to address this.
  • when will we configure the shopist_demo trigger? I think we need a JIRA to address this.

bitrise.yml Show resolved Hide resolved
if let someError = response.error {

let tracer = Global.sharedTracer
let span = tracer.startSpan(operationName: request.url?.path ?? "network request").setActive()
Copy link
Member

Choose a reason for hiding this comment

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

This usage of setActive() span is against the intention and will produce wrong traces if several requests are started simultaneously.

As we want the "network request" span to be the parent of "decoding response data" span, we should either:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 setRootSpan wasn't available during dev of this PR

rum?.startResourceLoading(
resourceName: resourceName,
url: fontURL,
httpMethod: .POST
Copy link
Member

Choose a reason for hiding this comment

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

GET seems more natural for fetching the font.

@@ -42,6 +75,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// Register global `RUMMonitor`
Global.rum = RUMMonitor.initialize()
rum?.addAttribute(forKey: "usr.handle", value: user.email)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

historical reasons i guess. when android did their shopist, rum-events wasn't around and they used usr.handle instead. sales people still seem to look for it (although they can get the same info from usr.email now)

Copy link
Member

Choose a reason for hiding this comment

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

OK, clear 👌. Maybe it's worth adding the comment above that coded, so this can be removed in the future once everyone sells it by usr.email 🙌.

fileprivate(set) var logger: Logger!
internal fileprivate(set) var logger: Logger! // swiftlint:disable:this implicitly_unwrapped_optional
internal let appConfig = AppConfig(serviceName: "ios-sdk-shopist-app")
internal var rum: DDRUMMonitor? { Global.rum }
Copy link
Member

Choose a reason for hiding this comment

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

Global.rum is no longer optional. Also - do we need this? Why not using Global.rum everywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Global.rum wasn't around when this PR started, i used global rum variable first and it stayed. we can replace them now

// Initialize Datadog SDK
Datadog.initialize(
appContext: .init(),
configuration: Datadog.Configuration
.builderUsing(
rumApplicationID: appConfig.rumAppID,
clientToken: appConfig.rumClientToken,
clientToken: appConfig.clientToken,
environment: "tests"
Copy link
Member

Choose a reason for hiding this comment

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

Let's use shop.ist environment name as Android does.

Screenshot 2020-09-02 at 10 46 20

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shop.ist is an illegal service name, apparently . is invalid char
i make it shopist 👍

Copy link
Member

Choose a reason for hiding this comment

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

So we have a different definition of valid env between platforms. This must be unified. I created JIRA, so this will be addressed later:

  • RUMM-700 Investigate the env name validation in Android RUM and iOS RUM

@@ -7,29 +7,62 @@
import UIKit
import Datadog

fileprivate(set) var logger: Logger!
internal fileprivate(set) var logger: Logger! // swiftlint:disable:this implicitly_unwrapped_optional
internal let appConfig = AppConfig(serviceName: "ios-sdk-shopist-app")
Copy link
Member

Choose a reason for hiding this comment

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

The serviceName defined here is not used anywhere, the demo data shows sh.shopist as the service. Let's use io.shopist.ios as a counterpart to Android:

Screenshot 2020-09-02 at 10 46 20

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 now appConfig.serviceName (io.shopist.ios) is used in DatadogConfiguration

Comment on lines 13 to 14
// randomizing cacheKey forces to make new request
let cacheKey = UUID().uuidString
Copy link
Member

Choose a reason for hiding this comment

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

Can't we use Alamofire's in-build caching API to disable caching? Defining empty AutoPurgingImageCache should do the same, but it's using regular API instead of hacking it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AF docs says we should use config.urlCache = nil while init'ing ImageDownloader
done ✅


override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
viewDidAppearDate = Date()
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
rum?.stopView(viewController: self)
Copy link
Member

Choose a reason for hiding this comment

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

When Checkout RUM View gets closed, the underlying view is not started, resulting with no active RUM View until some navigation action is taken:

Screenshot 2020-09-02 at 11 12 59

@buranmert
Copy link
Contributor Author

@ncreated

what about the IP randomization?

we have a ticket for that ✅

when will we configure the shopist_demo trigger?

based on Android team's experience, this should be an almost-trivial task.
i'll keep the current jira in progress until trigger is done, sounds okay?

Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

👍

@buranmert buranmert merged commit 8fbb21b into rum Sep 3, 2020
@buranmert buranmert deleted the buranmert/RUMM-664-shopist-ci branch September 3, 2020 10:56
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