-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: component exclusion config #128
Conversation
@@ -354,6 +355,16 @@ private final class Sdk( | |||
} | |||
} | |||
|
|||
private def isNotExcluded(clz: Class[_]): Boolean = { |
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.
could we avoid double negation here?
isExcluded
and then
componentClasses
.filter(hasComponentId)
.filterNot(isExcluded)
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.
done
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.
please, filterNot(i => !i.isNotExcluded)
😄
@@ -546,6 +558,7 @@ private final class Sdk( | |||
private val viewDescriptors: Seq[SpiViewDescriptor] = |
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.
why isn't viewDescriptors covered by above foreach in the same way as other components?
as it is now, views will be logged as "Unknown component"?
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.
fixed
@@ -546,6 +558,7 @@ private final class Sdk( | |||
private val viewDescriptors: Seq[SpiViewDescriptor] = | |||
componentClasses | |||
.filter(hasComponentId) | |||
.filter(isNotExcluded) | |||
.collect { | |||
case clz if classOf[View].isAssignableFrom(clz) => ViewDescriptorFactory(clz, serializer, sdkExecutionContext) | |||
} |
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 about HttpEndpoints? shouldn't those also be possible to exclude?
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.
good point, added filtering there
# Conflicts: # akka-javasdk/src/main/scala/akka/javasdk/impl/SdkRunner.scala
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.
looking good
@@ -1,2 +1,4 @@ | |||
# Using a different port to not conflict with parallel tests | |||
akka.javasdk.testkit.http-port = 39391 | |||
akka.javasdk.profiles.active = test |
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.
profile leftover
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.
removed
@@ -36,4 +38,5 @@ private[impl] object Settings { | |||
private[impl] final case class Settings( | |||
cleanupDeletedEventSourcedEntityAfter: Duration, | |||
cleanupDeletedKeyValueEntityAfter: Duration, | |||
devModeSettings: Option[DevModeSettings]) | |||
devModeSettings: Option[DevModeSettings], | |||
excludedComponents: Seq[String]) |
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.
Set
instead of Seq
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.
fixed
httpPort = sdkConfig.getInt("dev-mode.http-port")))) | ||
httpPort = sdkConfig.getInt("dev-mode.http-port"))), | ||
excludedComponents = | ||
Option(sdkConfig.getString("components.exclude")).fold(Seq.empty[String])(_.split(",").toSeq)) |
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.
why is this Option fold needed? shouldn't be null
as far as I can see
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.
could be good to .map(_.trim)
the values in case they use space in the config
exclude = "akkajavasdk.components.keyvalueentities.user.ProdCounterEntity, akkajavasdk.components.keyvalueentities.user.StageCounterEntity"
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.
yeah, initially, I wanted to add protection against a null case, good hint with trim, added
@@ -92,4 +92,6 @@ akka.javasdk { | |||
collector-endpoint = ${?COLLECTOR_ENDPOINT} | |||
} | |||
} | |||
# The comma separated list of FQCNs of components to exclude from running | |||
components.exclude = "" |
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.
Should it be exclude
or disable
?
Both are good of course. I'm just trying to imagine if one is easier to understand then the other.
If we say exclude
will people ask: exclude from what?
I don't know.
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.
disable
or disabled
?
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.
disable
as in imperative tense. Like in exclude
.
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.
changed
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.
LGTM
I left a comment earlier. No strong opinion. I just wanted to iterate once more on the names. Fine for merge with 'exclude' as well.
@@ -354,6 +355,16 @@ private final class Sdk( | |||
} | |||
} | |||
|
|||
private def isExcluded(clz: Class[_]): Boolean = { |
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.
isDisabled
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.
fixed
@@ -1,2 +1,3 @@ | |||
# Using a different port to not conflict with parallel tests | |||
akka.javasdk.testkit.http-port = 39391 | |||
akka.javasdk.components.disabled = "akkajavasdk.components.keyvalueentities.user.ProdCounterEntity,akkajavasdk.components.keyvalueentities.user.StageCounterEntity" |
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.
is this used by any test? it is wrong.
disabled
vs disable
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 noticed :) fixed
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.
LGTM
No description provided.