-
Notifications
You must be signed in to change notification settings - Fork 73
Hide symbols from public api #1278
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.android.agent.session | ||
|
||
import io.opentelemetry.api.trace.TraceId | ||
import kotlin.random.Random | ||
|
||
internal class DefaultSessionIdGenerator( | ||
private val random: Random, | ||
) : SessionIdGenerator { | ||
override fun generateSessionId(): String { | ||
// The OTel TraceId has exactly the same format as a RUM SessionId, so let's re-use it here, | ||
// rather than re-inventing the wheel. | ||
return TraceId.fromLongs(random.nextLong(), random.nextLong()) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.android.agent.session | ||
|
||
import io.opentelemetry.android.session.Session | ||
|
||
internal class InMemorySessionStorage( | ||
@Volatile var session: Session = Session.NONE, | ||
) : SessionStorage { | ||
override fun get(): Session = session | ||
|
||
override fun save(newSession: Session) { | ||
this.session = newSession | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
package io.opentelemetry.android.agent.session | ||
|
||
import io.opentelemetry.android.Incubating | ||
import io.opentelemetry.android.internal.services.applifecycle.ApplicationStateListener | ||
import io.opentelemetry.sdk.common.Clock | ||
import kotlin.time.Duration | ||
|
@@ -34,6 +35,7 @@ internal class SessionIdTimeoutHandler( | |
private var state = State.FOREGROUND | ||
|
||
// for testing | ||
@OptIn(Incubating::class) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed, given that the constructor is internal? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - |
||
internal constructor(sessionConfig: SessionConfig) : this( | ||
Clock.getDefault(), | ||
sessionConfig.backgroundInactivityTimeout, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,18 +7,8 @@ package io.opentelemetry.android.agent.session | |
|
||
import io.opentelemetry.android.session.Session | ||
|
||
interface SessionStorage { | ||
internal interface SessionStorage { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment -- I think this was visible because some users wanted to be able to provide their own storage mechanism? |
||
fun get(): Session | ||
|
||
fun save(newSession: Session) | ||
|
||
class InMemory( | ||
@Volatile var session: Session = Session.NONE, | ||
) : SessionStorage { | ||
override fun get(): Session = session | ||
|
||
override fun save(newSession: Session) { | ||
this.session = newSession | ||
} | ||
} | ||
} |
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.
Oh I think this was public on purpose. There have been users who previously wanted to provide their own session id values....
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 don't see any public-facing API that allows setting a custom
SessionIdGenerator
orSessionStorage
- what's the expected usage?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's not currently something users can provide via the initializer. The options we have are either hide them until needed, as proposed with these changes, or expose them right away, maybe via the
SessionConfig
object or the like. I'm fine either way tbh, though if we expose them right away, it's probably good to mark them all as incubating. Wdyt, @breedx-splk?