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

chore: added session timeout minutes config in OtelConfig #330

Merged
merged 3 commits into from
May 15, 2024

Conversation

Archish27
Copy link
Contributor

Fixes : #329

@Archish27 Archish27 requested a review from a team April 29, 2024 15:06
@breedx-splk
Copy link
Contributor

Hey thanks @Archish27. Take note that the build is currently broken and you should run ./gradlew spotlessApply to reformat the code and then push. Thanks!

Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @Archish27...I think this approach is solid, but I have noted a few changes that I think need to be made. Furthermore, the SdkPreconfiguredRumBuilder will also need to be modified to take the config and pass the configured timeout to the SessionIdTimeoutHandler that it creates.

Both of these cases are violations of the dependency injection principle, so maybe a better change is to have the SessionId passed into the constructors.

Thanks again!

@LikeTheSalad
Copy link
Contributor

Both of these cases are violations of the dependency injection principle, so maybe a better change is to have the SessionId passed into the constructors.

I agree, just to provide a bit more details, I think the steps to address this could be:

  • Removing this constructor.
  • Adding a new SdkPreconfiguredRumBuilder builder function into OpenTelemetryRum, similar to this one, though with a SessionId param.

@Archish27
Copy link
Contributor Author

Adding a new SdkPreconfiguredRumBuilder builder function into OpenTelemetryRum, similar to this one, though with a SessionId param.

Hey @LikeTheSalad SessionId seems to be getting exposed outside classes is the expected behavior? Also, along with SessionTimeoutHandler will get exposed too. Can you suggest what can we do here?

image

@LikeTheSalad
Copy link
Contributor

Adding a new SdkPreconfiguredRumBuilder builder function into OpenTelemetryRum, similar to this one, though with a SessionId param.

Hey @LikeTheSalad SessionId seems to be getting exposed outside classes is the expected behavior? Also, along with SessionTimeoutHandler will get exposed too. Can you suggest what can we do here?

image

Good point, we still haven't fully figured out what will be part of the public and/or internal classes so I don't have a clear answer here, although I think we can just expose them for now, taking into account that this project is not stable yet. And then we can re-evaluate this later once we have all the features we need for the first stable version and see if this makes sense as a public class or not within that state of the project. Otherwise, I think that slowing down development over these situations while the project is not stable would defeat the purpose of having it marked as not-stable right now. Any objections/thoughts on this @breedx-splk ?

this(Clock.getDefault(), TimeUnit.MINUTES.toNanos(15));
}

SessionIdTimeoutHandler(long sessionTimeoutMinutes) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason we don't use Duration here as well to make as more flexible? A granularity of minutes seems a bit coarse for general usage. Doing that will also mean we don't have to add a separate method just for testing, reducing the API surface.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, cleaner to use Duration here as well.

@breedx-splk
Copy link
Contributor

Good point, we still haven't fully figured out what will be part of the public and/or internal classes so I don't have a clear answer here, although I think we can just expose them for now, taking into account that this project is not stable yet.

Yeah, I was surprised that SessionId wasn't already public!

And then we can re-evaluate this later once we have all the features we need for the first stable version and see if this makes sense as a public class or not within that state of the project. Otherwise, I think that slowing down development over these situations while the project is not stable would defeat the purpose of having it marked as not-stable right now. Any objections/thoughts on this @breedx-splk ?

No objections, I think I agree. Fixing this is definitely not in scope for this PR, which I think is getting pretty close to being ready. Long-term, I think the right approach is to make SessionId an interface whose only no-op implementation exists in the agent sdk. This allows us to have public api surface area while keeping some of the implementation details private/internal.

Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

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

I'm fine with us changing to Duration in a follow-up PR. I think that's the last piece of feedback. Thanks!

@breedx-splk breedx-splk merged commit d35c601 into open-telemetry:main May 15, 2024
3 checks passed
bidetofevil pushed a commit to bidetofevil/opentelemetry-android that referenced this pull request May 18, 2024
…etry#330)

* chore: added session timeout minutes config in OtelConfig

* chore: added custom timeout in otel config

* chore: Formatting fixes
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.

Configuring session handler timeout time
4 participants