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

Introduce a SplunkRumBuilder class and deprecate Config #342

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

mateuszrzeszutek
Copy link
Contributor

No description provided.

@mateuszrzeszutek mateuszrzeszutek requested review from a team as code owners August 30, 2022 15:34
*
* @return {@code this}
*/
public SplunkRumBuilder disableCrashReporting(boolean disabled) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to rename these boolean settings methods a bit, I used open-telemetry/opentelemetry-specification#2729 (comment) as the inspiration -- the default value of all of these methods is false.

I was wondering whether we need the boolean parameters at all, after all we could just assume true -- but I think that in the beginning of this project we decided to accept a boolean arg to make setting these flags based on configuration easier.

Copy link
Contributor

Choose a reason for hiding this comment

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

As long as our semantics for the default state are unchanged (like when the user omits these calls entirely), my preference is strongly in favor of no-arg versions disableCrashReporting() and enableCrashReporting(). It's hard to reason about disableCrashReporting(false) (and it's pretty gross to be honest).

Same applies to all the other flags below.

For flags that default to true/enabled, I think there's a case to be made for omitting the enableXXX() methods, but for users who might have to pass the builder around a few places and might want to override a previous components setting on the builder, the parity is nice.

Make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sense?

Yeah 👍

for users who might have to pass the builder around a few places and might want to override a previous components setting on the builder, the parity is nice.

I think that we could possibly add setter methods (setDebugEnabled(boolean)) for these scenarios; but I think I'd rather skip them for now and only add them when we're requested to.

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.

This is coming along very nicely 👍🏻
Had a few ideas, but nothing to stop the boat.


static class Factory {

ConnectionUtil create(Application application) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a method comment to explain to the caller that the returned util has already been started monitoring? Or could rename to createAndStart() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or could rename to createAndStart()

👍

import java.util.function.Consumer;

/** A builder of {@link SplunkRum}. */
public final class SplunkRumBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we delegated to the Config for now and did this work in the subsequent version that removes it?

It's pure duplication, right? So pure delegation should be safe/ok? I just hate to open us up to divergence....but it's probably fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What if we delegated to the Config for now and did this work in the subsequent version that removes it?

It's pure duplication, right? So pure delegation should be safe/ok? I just hate to open us up to divergence....but it's probably fine.

Yeah, it would work perfectly fine. Should I do it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Your call. I don't want to create more work, and the deprecation will be here soon enough. 🤷🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm kinda lazy, so I'm inclined to leave it as it is 😅

*
* @return {@code this}
*/
public SplunkRumBuilder disableCrashReporting(boolean disabled) {
Copy link
Contributor

Choose a reason for hiding this comment

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

As long as our semantics for the default state are unchanged (like when the user omits these calls entirely), my preference is strongly in favor of no-arg versions disableCrashReporting() and enableCrashReporting(). It's hard to reason about disableCrashReporting(false) (and it's pretty gross to be honest).

Same applies to all the other flags below.

For flags that default to true/enabled, I think there's a case to be made for omitting the enableXXX() methods, but for users who might have to pass the builder around a few places and might want to override a previous components setting on the builder, the parity is nice.

Make sense?

@mateuszrzeszutek mateuszrzeszutek merged commit 7eb5047 into main Sep 13, 2022
@mateuszrzeszutek mateuszrzeszutek deleted the splunk-rum-builder branch September 13, 2022 16:18
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.

2 participants