-
Notifications
You must be signed in to change notification settings - Fork 217
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
added logstash model for converter #447
added logstash model for converter #447
Conversation
Signed-off-by: Asif Sohail Mohammed <[email protected]>
4ef1439
to
34bac23
Compare
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 rename the classes to be more explicit about what is being modeled and cleanup the build.gradle file for the data-prepper-logstash-configuration
...er-logstash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/Attribute.java
Outdated
Show resolved
Hide resolved
...gstash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/AttributeValue.java
Outdated
Show resolved
Hide resolved
...epper-logstash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/Config.java
Outdated
Show resolved
Hide resolved
...epper-logstash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/Plugin.java
Outdated
Show resolved
Hide resolved
...r-logstash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/PluginType.java
Outdated
Show resolved
Hide resolved
...er-logstash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/ValueType.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Asif Sohail Mohammed <[email protected]>
...ash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/LogstashAttribute.java
Outdated
Show resolved
Hide resolved
...ash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/LogstashAttribute.java
Outdated
Show resolved
Hide resolved
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 add the @since 1.2
on the enum class and I'll approve.
...ash-configuration/src/main/java/com/amazon/dataprepper/logstash/model/LogstashValueType.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Asif Sohail Mohammed <[email protected]>
65bb564
to
da7a37b
Compare
public void setAttributeName(String attributeName) { | ||
this.attributeName = attributeName; | ||
} |
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.
Are we allowing these objects to be multated? I would recommend we avoid mutation as it is harder to debug. If we can remove the setter functions, please make the attributeValue and attribute name as final.
If we need these setters, plese make the method parameter to the method final. Same is true for the other model objects.
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, they should be immutable. Will update the model
Are we not going to use the builder pattern for creating our model objects? |
Signed-off-by: Asif Sohail Mohammed <[email protected]>
c164e17
this.attributeValue = builder.attributeValue; | ||
} | ||
|
||
public static class LogstashAttributeBuilder { |
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.
Let's just call this Builder
. Otherwise, we will invoke the builder like so: LogstashAttribute = new LogstashAttribute.LogstashAttributeBuilder().build();
I would also recommend creating a public static method to get the builder so we can avoid having to use new
:
public static Builder builder() {
return new Builder();
}
Then we could just invoke the builder like so:
final LogstashAttribute logstashAttribute = LogstashAttribute.builder()
.withAttributeValue(attributeValue)
.withAttributeName("foobar")
.build();
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.
@cmanning09 great advice.
this.attributeName = builder.attributeName; | ||
this.attributeValue = builder.attributeValue; |
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.
Do we have any requirements on these values? Can they be null or do we need to enforce non-null?
The same question applies to the other models.
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.
Technically they shouldn't be null, but we might have some section in configuration left empty and we have to use default values.
For example, it can be like
http{
}
But I think we can still add a validate method to enforce non-null
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.
@asifsmohammed can you go ahead and add the validation for non-nulls?, please.
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.
In the case of:
http {
}
You should have an empty array of LogstashAttribute
in the LogstashPlugin
. I'm unsure if the attributeValue
can be null or not, but the attributeName
should not be null.
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.
I've added the non-null validation.
Signed-off-by: Asif Sohail Mohammed <[email protected]>
One additional comment: We know that we want to move our packages to However, this is a brand new sub-module within Data Prepper. Should we use this new package in here starting now? Or do we just want to change them all in v2.0? |
This is new work, let's go ahead and start the migration to org.opensearch.dataprepper with this. @asifsmohammed, sorry for making this a longer review than normal, but it's a good place to start doing the work. |
Signed-off-by: Asif Sohail Mohammed <[email protected]>
Description
Added sub-project data-prepper-logstash-configuration and Logstash model to store the information from Logstash configuration files.
Issues Resolved
Resolve #446
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.