NIFI-11308 Adding expression language function to return nifi version#8101
NIFI-11308 Adding expression language function to return nifi version#8101annanys23 wants to merge 6 commits intoapache:mainfrom
Conversation
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for proposing this new feature @annanys23.
The concept seems useful, but the implementation is problematic because it introduces framework-level dependencies to the expression language library, which is contrary to the general design of the system.
A simpler approach would be to configure the Maven JAR Plugin to write the standard manifest entries, and then use standard Java Package implementation version methods to retrieve the version from that expression language library itself.
Although nifiVersion is fairly clear, it might be better to name this frameworkVersion instead.
|
I agree, we definitely want to avoid adding any sort of framework-specific dependencies to the nifi-expression-language module. Ideally, though, I think we should actually avoid updating the Expression Language at all. There's no need to expose a new function for this, but instead just update |
.../src/main/java/org/apache/nifi/attribute/expression/language/compile/ExpressionCompiler.java
Outdated
Show resolved
Hide resolved
|
Thanks for the review and suggestions! |
| this.jettyBundle = jettyBundle; | ||
| this.serverInstance = serverInstance; | ||
| this.bundles = bundles; | ||
| System.setProperty("nifi.version", frameworkBundle.getBundleDetails().getCoordinate().getVersion()); |
There was a problem hiding this comment.
Recommend adding a comment indicating the reason for this addition. I would recommend naming this framework.version to avoid potential confusion that could result from different NAR extension versions, which are also part of NiFi, but could be different in particular installations.
There was a problem hiding this comment.
@exceptionfactory A concern I have is how will users know this property exists in order to take advantage of it? Shouldn't this PR include documenting this system property is now available?
There was a problem hiding this comment.
agreed. where are the properties documented?
There was a problem hiding this comment.
I see there is a section for System properties in the user guide but I am not sure that would be the place for this particular system property.
There was a problem hiding this comment.
Good point @dan-s1. The Expression Language Guide notes that System properties can be referenced, but does not list any of them. This probably warrants a new short sub-section along the lines of Framework System Properties, above the Functions section.
There was a problem hiding this comment.
Could we name this system property nifi.framework.version? This is more specific and may avoid confusion with generic system properties that are not related to NiFi.
There was a problem hiding this comment.
changed prop name to: nifi.framework.version and added a section to the Expression Language Guide. Are there any other system properties that need to be documented? I did not find any, outside of test classes.
… version" This reverts commit 6cc25d8. Reverting expression language update in favor of setting system property with the nifi version.
4749af5 to
324e1a9
Compare
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for working through the feedback and updating the documentation @annanys23, the latest version looks good. Thanks for the recommendation on the implementation @markap14. +1 merging
Summary
NIFI-11308
New ExpL function added: ${nifiVersion()}
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation