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

Added metadata to NavigationPerformanceEvent #1820

Merged
merged 5 commits into from Mar 21, 2019

Conversation

devotaaabel
Copy link
Contributor

@devotaaabel devotaaabel commented Mar 15, 2019

Title

Added metadata to NavigationPerformanceEvent

What's the goal?

Goal is to add metadata to NavigationPerformanceEvent

How is it being implemented?

There are now two constructors for the NavigationPerformanceEvent, one for creating an event with metadata, and one for creating an event without metadata.

How has this been tested?

  • Check the events in the log
  • Check the events in mode

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • New and existing unit tests pass locally with my changes

@devotaaabel devotaaabel added the bug Defect to be fixed. label Mar 15, 2019
@devotaaabel devotaaabel self-assigned this Mar 15, 2019
@codecov-io
Copy link

codecov-io commented Mar 20, 2019

Codecov Report

Merging #1820 into master will decrease coverage by 0.13%.
The diff coverage is 0%.

@@             Coverage Diff              @@
##             master    #1820      +/-   ##
============================================
- Coverage     31.96%   31.82%   -0.14%     
+ Complexity      949      947       -2     
============================================
  Files           242      244       +2     
  Lines          8506     8533      +27     
  Branches        647      646       -1     
============================================
- Hits           2719     2716       -3     
- Misses         5540     5570      +30     
  Partials        247      247

@devotaaabel devotaaabel marked this pull request as ready for review March 20, 2019 16:11
@@ -10,8 +11,9 @@
private static final String IS_PLUGGED_IN_KEY = "is_plugged_in";
private static final String BATTERY_EVENT_NAME = "battery_event";

BatteryEvent(String sessionId, float batteryPercentage, boolean isPluggedIn) {
super(sessionId, BATTERY_EVENT_NAME);
BatteryEvent(Context context, String sessionId, float batteryPercentage, boolean isPluggedIn,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the Context necessary here?


NavigationPerformanceEvent(String sessionId, String eventName) {
NavigationPerformanceEvent(String sessionId, String eventName,
Copy link
Contributor

Choose a reason for hiding this comment

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

There are now two constructors for the NavigationPerformanceEvent, one for creating an event with metadata, and one for creating an event without metadata.

Is this necessary? Wondering if we always want to capture the metadata 🤔 I guess so, right?

}

NavigationPerformanceEvent(@Nullable Context context, String sessionId, String eventName,
NavigationPerformanceMetadata metadata) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? Wondering if we always want to capture the metadata 🤔 I guess so, right?

Actually, the metadata is a parameter in both constructors.

attributes.add(new Attribute(EVENT_NAME, eventName));
if (context != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary? Wondering if we always want to capture the screen density 🤔 I guess so, right?

attributes.add(new Attribute(EVENT_NAME, eventName));
if (context != null) {
attributes.add(new Attribute(SCREEN_DENSITY, getScreenDensity(context)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the Context necessary here?

What about passing in the screen density through the constructor so the Context wouldn't be necessary?


NavigationPerformanceMetadata(Context context) {
this.version = VERSION;
this.screenSize = getScreenSize(context);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the Context necessary here?

What about passing in the screen size through the constructor so the Context wouldn't be necessary?

NavigationPerformanceMetadata(Context context) {
this.version = VERSION;
this.screenSize = getScreenSize(context);
this.country = getCountry(context);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the Context necessary here?

What about passing in the country through the constructor so the Context wouldn't be necessary?

this.device = DEVICE;
this.abi = ABI;
this.brand = BRAND;
this.ram = getTotalMemory(context);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the Context necessary here?

What about passing in the total memory through the constructor so the Context wouldn't be necessary?

private final String gpu;
private final String manufacturer;

NavigationPerformanceMetadata(Context context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the Context necessary here?

Shouldn't NavigationPerformanceMetadata be a DTO / POJO?

@devotaaabel
Copy link
Contributor Author

Ready for re-review @Guardiola31337

@@ -10,7 +10,7 @@
private static final String INITIAL_GPS_EVENT_NAME = "initial_gps_event";

InitialGpsEvent(double elapsedTime, String sessionId) {
super(sessionId, INITIAL_GPS_EVENT_NAME);
super(sessionId, INITIAL_GPS_EVENT_NAME, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering why we aren't capturing the metadata for InitialGpsEvent 🤔 Is there any limitation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes @Guardiola31337 there is a race condition with the InitialGpsEventFactory where it's initialized before NavigationTelemetry is initialized. I tried initializing it later but got an error, I don't remember what it was.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a quick TODO comment so we don't forget to include the metadata in InitialGpsEvents eventually?

import android.os.Build;
import android.util.DisplayMetrics;

public class MetadataBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could MetadaBuilder be package-private?

attributes.add(new Attribute(EVENT_NAME, eventName));
}

private String getScreenDensity(Context context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Noticed that we're not adding the screen density as attribute anymore, was that on purpose? If so, we should remove this method, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it was on purpose, I don't think it's a good idea to add added complexity for an attribute we're not sure we'll even need.

@devotaaabel devotaaabel merged commit f66f26b into master Mar 21, 2019
@devotaaabel devotaaabel deleted the devota-performance-metadata branch March 21, 2019 19:46
@danesfeder danesfeder mentioned this pull request Mar 22, 2019
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect to be fixed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants