-
Notifications
You must be signed in to change notification settings - Fork 625
Add register api to FirebaseSessions so products can integrate #4989
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
# Conflicts: # firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessionsRegistrar.kt # firebase-sessions/src/test/kotlin/com/google/firebase/sessions/SessionCoordinatorTest.kt
Coverage Report 1Affected Products
Test Logs |
The public api surface has changed for the subproject firebase-sessions: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
Size Report 1Affected Products
Test Logs |
Javadoc Changes:--- /Users/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/sessions/FirebaseSessions.html 2023-05-12 19:09:09.000000000 +0000
+++ /Users/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/sessions/FirebaseSessions.html 2023-05-12 19:04:02.000000000 +0000
@@ -72,9 +72,10 @@
</td>
</tr>
<tr>
- <td><code>final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a></code></td>
+ <td><code>final void</code></td>
<td>
- <div><code>@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/Discouraged.html">Discouraged</a>(message = "This will be replaced with a real API.")<br><a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.html#greeting()">greeting</a>()</code></div>
+ <div><code><a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">register</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.html">SessionSubscriber</a> subscriber)</code></div>
+ <p>Register the <code><a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">subscriber</a></code>.</p>
</td>
</tr>
</tbody>
@@ -93,9 +94,10 @@
<h3 class="api-name" id="getInstance(com.google.firebase.FirebaseApp)">getInstance</h3>
<pre class="api-signature no-pretty-print">public static final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.html">FirebaseSessions</a> <a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.Companion.html#getInstance(com.google.firebase.FirebaseApp)">getInstance</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/docs/reference/android/com/google/firebase/FirebaseApp.html">FirebaseApp</a> app)</pre>
</div>
- <div class="api-item"><a name="greeting--"></a><a name="greeting"></a>
- <h3 class="api-name" id="greeting()">greeting</h3>
- <pre class="api-signature no-pretty-print">@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/Discouraged.html">Discouraged</a>(message = "This will be replaced with a real API.")<br>public final @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/String.html">String</a> <a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.html#greeting()">greeting</a>()</pre>
+ <div class="api-item"><a name="register-com.google.firebase.sessions.api.SessionSubscriber-"></a><a name="register"></a>
+ <h3 class="api-name" id="register(com.google.firebase.sessions.api.SessionSubscriber)">register</h3>
+ <pre class="api-signature no-pretty-print">public final void <a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">register</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.html">SessionSubscriber</a> subscriber)</pre>
+ <p>Register the <code><a href="/docs/reference/android/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">subscriber</a></code>. This must be called for every dependency.</p>
</div>
</div>
</body> --- /Users/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html 2023-05-12 19:09:09.000000000 +0000
+++ /Users/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html 2023-05-12 19:04:02.000000000 +0000
@@ -48,6 +48,10 @@
<td></td>
</tr>
<tr>
+ <td><code><a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html#MATT_SAYS_HI">MATT_SAYS_HI</a></code></td>
+ <td></td>
+ </tr>
+ <tr>
<td><code><a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html#PERFORMANCE">PERFORMANCE</a></code></td>
<td></td>
</tr>
@@ -90,6 +94,10 @@
<pre class="api-signature no-pretty-print"><a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html">SessionSubscriber.Name</a> <a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html#CRASHLYTICS">SessionSubscriber.Name.CRASHLYTICS</a></pre>
</div>
<div class="api-item">
+ <h3 class="api-name" id="MATT_SAYS_HI">MATT_SAYS_HI</h3>
+ <pre class="api-signature no-pretty-print"><a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html">SessionSubscriber.Name</a> <a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html#MATT_SAYS_HI">SessionSubscriber.Name.MATT_SAYS_HI</a></pre>
+ </div>
+ <div class="api-item">
<h3 class="api-name" id="PERFORMANCE">PERFORMANCE</h3>
<pre class="api-signature no-pretty-print"><a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html">SessionSubscriber.Name</a> <a href="/docs/reference/android/com/google/firebase/sessions/api/SessionSubscriber.Name.html#PERFORMANCE">SessionSubscriber.Name.PERFORMANCE</a></pre>
</div> --- /Users/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/sessions/FirebaseSessions.html 2023-05-12 19:09:09.000000000 +0000
+++ /Users/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/sessions/FirebaseSessions.html 2023-05-12 19:04:02.000000000 +0000
@@ -67,9 +67,10 @@
</thead>
<tbody class="list">
<tr>
- <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></code></td>
+ <td><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></code></td>
<td>
- <div><code>@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/Discouraged.html">Discouraged</a>(message = "This will be replaced with a real API.")<br><a href="/docs/reference/kotlin/com/google/firebase/sessions/FirebaseSessions.html#greeting()">greeting</a>()</code></div>
+ <div><code><a href="/docs/reference/kotlin/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">register</a>(subscriber: <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.html">SessionSubscriber</a>)</code></div>
+ <p>Register the <code><a href="/docs/reference/kotlin/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">subscriber</a></code>.</p>
</td>
</tr>
</tbody>
@@ -91,9 +92,10 @@
</div>
<div class="list">
<h2>Public functions</h2>
- <div class="api-item"><a name="greeting--"></a><a name="greeting"></a>
- <h3 class="api-name" id="greeting()">greeting</h3>
- <pre class="api-signature no-pretty-print">@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/Discouraged.html">Discouraged</a>(message = "This will be replaced with a real API.")<br>fun <a href="/docs/reference/kotlin/com/google/firebase/sessions/FirebaseSessions.html#greeting()">greeting</a>(): <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></pre>
+ <div class="api-item"><a name="register-com.google.firebase.sessions.api.SessionSubscriber-"></a><a name="register"></a>
+ <h3 class="api-name" id="register(com.google.firebase.sessions.api.SessionSubscriber)">register</h3>
+ <pre class="api-signature no-pretty-print">fun <a href="/docs/reference/kotlin/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">register</a>(subscriber: <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.html">SessionSubscriber</a>): <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a></pre>
+ <p>Register the <code><a href="/docs/reference/kotlin/com/google/firebase/sessions/FirebaseSessions.html#register(com.google.firebase.sessions.api.SessionSubscriber)">subscriber</a></code>. This must be called for every dependency.</p>
</div>
</div>
</body> --- /Users/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html 2023-05-12 19:09:09.000000000 +0000
+++ /Users/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html 2023-05-12 19:04:02.000000000 +0000
@@ -48,6 +48,10 @@
<td></td>
</tr>
<tr>
+ <td><code><a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html#MATT_SAYS_HI">MATT_SAYS_HI</a></code></td>
+ <td></td>
+ </tr>
+ <tr>
<td><code><a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html#PERFORMANCE">PERFORMANCE</a></code></td>
<td></td>
</tr>
@@ -90,6 +94,10 @@
<pre class="api-signature no-pretty-print">val <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html#CRASHLYTICS">SessionSubscriber.Name.CRASHLYTICS</a>: <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html">SessionSubscriber.Name</a></pre>
</div>
<div class="api-item">
+ <h3 class="api-name" id="MATT_SAYS_HI">MATT_SAYS_HI</h3>
+ <pre class="api-signature no-pretty-print">val <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html#MATT_SAYS_HI">SessionSubscriber.Name.MATT_SAYS_HI</a>: <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html">SessionSubscriber.Name</a></pre>
+ </div>
+ <div class="api-item">
<h3 class="api-name" id="PERFORMANCE">PERFORMANCE</h3>
<pre class="api-signature no-pretty-print">val <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html#PERFORMANCE">SessionSubscriber.Name.PERFORMANCE</a>: <a href="/docs/reference/kotlin/com/google/firebase/sessions/api/SessionSubscriber.Name.html">SessionSubscriber.Name</a></pre>
</div> |
Startup Time Report 1Note: Layout is sometimes suboptimal due to limited formatting support on GitHub. Please check this report on GCS. Startup time comparison between the CI merge commit (a9d0fef) and the base commit (6c066f3) are not available. No macrobenchmark data found for the base commit (6c066f3). Analysis for the CI merge commit (a9d0fef) can be found at: |
firebase-sessions/api.txt
Outdated
@@ -17,3 +17,51 @@ package com.google.firebase.sessions { | |||
|
|||
} | |||
|
|||
package com.google.firebase.sessions.api { |
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.
Just a curiosity question on the purpose of api.txt. All of these are private/internal APIs - why document them here?
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 was auto-generated by ./gradlew :firebase-sessions:generateApiTxtFile
but it seems fine if I delete all these internal apis.
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.
What are the legit APIs that should find a place here? Secondly, how do we control what does inside this file? We can do this as a separate validation task before we go out for launch.
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.
Ideally I would like this to not expose any public API since it's for internal products only. But we need at least this to be public for Firebase to work with it.
firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessions.kt
Show resolved
Hide resolved
firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessions.kt
Show resolved
Hide resolved
firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessions.kt
Outdated
Show resolved
Hide resolved
firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessions.kt
Outdated
Show resolved
Hide resolved
} catch (ex: Exception) { | ||
Log.e(TAG, "Error getting Firebase Installation ID: ${ex}. Using an empty ID") | ||
// Use an empty fid if there is any failure. | ||
"" |
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.
Do we want to allow dispatching events with empty fid
s? Can we stop from such events to go through? Empty FID could lead to invalid data ingested.
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 am not sure. @samedson and I talked and thought this was better, we even updated iOS to do the same firebase/firebase-ios-sdk#11161 I am ok with dropping the event instead but we'll need to revert that iOS change to keep it consistent.
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.
Do you remember the rationale as to why it is fine to dispatch an event with empty FID? Because, backend is going to drop it anyways since this event would be accounted as invalid.
...se-sessions/src/main/kotlin/com/google/firebase/sessions/api/FirebaseSessionsDependencies.kt
Outdated
Show resolved
Hide resolved
firebase-sessions/src/test/kotlin/com/google/firebase/sessions/SessionCoordinatorTest.kt
Outdated
Show resolved
Hide resolved
# Conflicts: # firebase-sessions/src/main/kotlin/com/google/firebase/sessions/api/SessionSubscriber.kt
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.
All changes look good to me except for the empty FID scenario. Once that is clarified, this is good to get merged.
firebase-sessions/src/main/kotlin/com/google/firebase/sessions/FirebaseSessions.kt
Show resolved
Hide resolved
firebase-sessions/src/main/kotlin/com/google/firebase/sessions/api/SessionSubscriber.kt
Show resolved
Hide resolved
firebase-sessions/api.txt
Outdated
@@ -17,3 +17,51 @@ package com.google.firebase.sessions { | |||
|
|||
} | |||
|
|||
package com.google.firebase.sessions.api { |
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.
What are the legit APIs that should find a place here? Secondly, how do we control what does inside this file? We can do this as a separate validation task before we go out for launch.
} catch (ex: Exception) { | ||
Log.e(TAG, "Error getting Firebase Installation ID: ${ex}. Using an empty ID") | ||
// Use an empty fid if there is any failure. | ||
"" |
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.
Do you remember the rationale as to why it is fine to dispatch an event with empty FID? Because, backend is going to drop it anyways since this event would be accounted as invalid.
# Conflicts: # firebase-sessions/src/main/kotlin/com/google/firebase/sessions/api/SessionSubscriber.kt
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 looks great 👍
Add register api to FirebaseSessions so products can integrate with Sessions.