Skip to content

Conversation

fractalwrench
Copy link
Member

Goal

This changeset hides symbol from the public API exposed in agent-api. SessionStorage and SessionIdGenerator don't appear to be usable for an external consumer of the library, so IMO it makes sense to hide the concepts for now. I additionally separated out the implementations from the interfaces.

@fractalwrench fractalwrench requested a review from a team as a code owner October 2, 2025 10:15
Copy link

codecov bot commented Oct 2, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 64.32%. Comparing base (f466e65) to head (e97e80f).

Files with missing lines Patch % Lines
...ry/android/agent/session/InMemorySessionStorage.kt 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1278      +/-   ##
==========================================
+ Coverage   64.30%   64.32%   +0.01%     
==========================================
  Files         142      142              
  Lines        3012     3013       +1     
  Branches      296      296              
==========================================
+ Hits         1937     1938       +1     
  Misses        998      998              
  Partials       77       77              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@LikeTheSalad LikeTheSalad left a comment

Choose a reason for hiding this comment

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

LGTM.

private var state = State.FOREGROUND

// for testing
@OptIn(Incubating::class)
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 needed, given that the constructor is internal?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - @Incubating propagates so that any usage of an annotated symbol will require an opt-in, regardless of visibility. This suppresses a couple of compiler warnings that got introduced in the PR that added it. The alternative is to remove the annotation from SessionConfig

import java.util.Random

interface SessionIdGenerator {
internal fun interface SessionIdGenerator {
Copy link
Contributor

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....

Copy link
Member Author

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 or SessionStorage - what's the expected usage?

Copy link
Contributor

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?

import io.opentelemetry.android.session.Session

interface SessionStorage {
internal interface SessionStorage {
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

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.

4 participants