-
Notifications
You must be signed in to change notification settings - Fork 625
Fix encoding for Session Events #4870
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
Conversation
Coverage Report 1Affected Products
Test Logs |
Size Report 1Affected Products
Test Logs |
Are these TODOs still to be done or are they verified? |
@@ -53,11 +54,14 @@ internal class EventGDTLogger(private val transportFactoryProvider: Provider<Tra | |||
} | |||
|
|||
private fun encode(value: SessionEvent): ByteArray { | |||
return SessionEvents.SESSION_EVENT_ENCODER.encode(value).toByteArray() | |||
val jsonEvent = SessionEvents.SESSION_EVENT_ENCODER.encode(value) | |||
Log.d(TAG, "Encoded Session Start event $jsonEvent") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious if you want to leave this as Debug
or Verbose
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm down for Verbose - I wasn't sure when we use debug vs verbose
} | ||
|
||
companion object { | ||
// TODO What do we put for the AQS Log Source | ||
private const val TAG = "EventGDTLogger" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would the log message look with this TAG? Would it contain FirebaseSessions
anywhere? If not, I would recommend prefixing the tag with the library name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like: V/EventGDTLogger: Encoded Session Start event {"event_type":1...
We've been doing it like this so I'll update this file and others
internal data class DataCollectionStatus( | ||
val performance: DataCollectionState = DataCollectionState.COLLECTION_ENABLED, | ||
val crashlytics: DataCollectionState = DataCollectionState.COLLECTION_ENABLED, | ||
val sessionSamplingRate: Double = 1.0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting to have sessionSamplingRate inside the DataCollectionStatus
. I was thinking DataCollectionStatus is for external dependencies and used sessionSamplingRate as a remote config. But this looks a bit different from that intention. Curious to hear your rationale to have session sampling rate inside DataCollectionStatus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how it is in our proto -
I wanted to be consistent with how it's defined: https://source.corp.google.com/piper///depot/google3/logs/proto/firebase/appquality/sessions/session_event.proto;l=67?q=DataCollectionStatus
val performance: DataCollectionState = DataCollectionState.COLLECTION_ENABLED, | ||
val crashlytics: DataCollectionState = DataCollectionState.COLLECTION_ENABLED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the default COLLECTION_ENABLED
(for now?)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm putting it like this so it looks right in our data but we'll need to change this when we integrate with the product SDKs
@@ -32,7 +32,8 @@ class SessionEventTest { | |||
val sessionEvent = | |||
SessionEvents.startSession( | |||
FakeFirebaseApp.fakeFirebaseApp(), | |||
TestSessionEventData.TEST_SESSION_DETAILS | |||
TestSessionEventData.TEST_SESSION_DETAILS, | |||
TestSessionEventData.TEST_SESSION_TIMESTAMP_US, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why the event timestamp is configurable? Can we leave it as a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
startSession
is also used by the SDK. When it leaves off the parameter it uses the current time. Since we can't have the time be different for every test I made it optional to just set the time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine for now, but we need a proper time solution at some point. We can't just use go/javatime because it requires Android API level 26+. Maybe we can add another function in WallClock
and try to abstract this away?
I'm doing the TODOs in a follow up PR |
TODO (in a follow up)