-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
implement PerfBackgroundJsonValidation feature-flag #21569
Conversation
Airbyte Code Coverage
|
airbyte-commons-worker/src/main/java/io/airbyte/workers/RecordSchemaValidator.java
Outdated
Show resolved
Hide resolved
fc2a97b
to
822dfe8
Compare
@@ -4,11 +4,12 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |||
plugins { | |||
`java-library` | |||
kotlin("jvm") version "1.8.0" | |||
kotlin("kapt") version "1.8.0" |
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 a koitlin specific annotation processor?
@@ -43,6 +57,16 @@ public void validateSchema(final AirbyteRecordMessage message, final AirbyteStre | |||
final JsonNode messageData = message.getData(); | |||
final JsonNode matchingSchema = streams.get(messageStream); | |||
|
|||
if (workspaceId != null) { | |||
if (featureFlagClient.enabled(PerfBackgroundJsonValidation.INSTANCE, new Workspace(workspaceId))) { | |||
log.info("feature flag enabled for workspace {}", workspaceId); |
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 the separate threading changes? Or does this PR only include the feature flag changes?
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.
also to confirm, we'll opt in workspaces via adding the workspace id in LauchDarkly?
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.
This only includes the feature-flag changes. A quick, follow-up PR will add in the actual changes that will be contained within the feature-flag.
This allows me to vet that the client is working as expected and seeing updated from LaunchDarkly without having an impact on any users.
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.
@colesnodgrass I think we are going to have a merge conflict. Do you mind letting me merge in my PR first before we merge in yours?
What
PerfBackgroundJsonValidation
feature-flag within theRecordSchemaValidator
classHow
start plumbing in the
FeatureFlagClient
in all the necessary places to get feature-flag support within theRecordSchemaValidator
FeatureFlags
is still present in these files as I wanted to limit the scope changes to implement this singlePerfBackgroundJsonValidation
flagthis feature-flag doesn't do anything other than change a log message, once functionality has been verified, this will be updated to do real work
the feature-flag check is done in the following way:
I am unsure if a
workspaceId
will exist at this point in the code (thesyncInput
object supports aworkspaceId
but doesn't require one)Lessons Learned
Micronaut property checking issues
Micronaut does not handle the following situation well:
Instead redefine the situation as:
To summarize use
@Requires(property=P, value=WELL_DEFINED)
with@Requires(property=P, notEquals=WELL_DEFINED)
. Do not use@Requires(property=P)
with@Requires(missingProperty=P)
or@Requires(property=P, pattern=NON_EMPTY_REGEX)
with@Requires(property=P, pattern=EMPTY_REGEX)
This also appears to be related to this Micronaut issue
Micronaut Kotlin Dependencies
I spent a lot of time with trying to get the Kotlin beans injectable into the java code. What should just work doesn't and it well documented on the Micronaut side as to what exactly is required (or at least I never found the documentation). After many attempts I and looking at the auto-generated kotlin Micronaut projects I landed on
kapt
being necessary in kotlin projects. Even this isn't entirely true.If the Kotlin project is defined with the following gradle setup, the beans will not be visible to java projects (and possibly other projects as well):
But they will be visible with the following setup:
and also visible with the following setup:
I went with the
kapt
solution.It's worth noting that
kapt
is deprecated and is being replaced withkps
in Micronaut 4 (this is a good thing).