You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "pvillard31 (via GitHub)" <gi...@apache.org> on 2023/10/19 20:14:11 UTC

[PR] NIFI-12253 NIFI-12230 - Add configurable log level for IP not found and fix GeoEnrichIPRecord [nifi]

pvillard31 opened a new pull request, #7909:
URL: https://github.com/apache/nifi/pull/7909

   # Summary
   
   [NIFI-12253](https://issues.apache.org/jira/browse/NIFI-12253) - GeoEnrichIPRecord does not route FF to not found
   [NIFI-12230](https://issues.apache.org/jira/browse/NIFI-12230) - GeoEnrichIP shouldn't produce a message when an IP is not found
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
     - [ ] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12253 NIFI-12230 - Add configurable log level for IP not found and fix GeoEnrichIPRecord [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #7909:
URL: https://github.com/apache/nifi/pull/7909#discussion_r1366117389


##########
nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-processors/src/main/java/org/apache/nifi/processors/GeoEnrichIP.java:
##########
@@ -130,6 +132,28 @@ public void onTrigger(final ProcessContext context, final ProcessSession session
             getLogger().warn("Failure while trying to load enrichment data for {} due to {}, rolling back session "
                     + "and will reload the database on the next run", flowFile, idbe.getMessage());
             session.rollback();
+            return;
+        } catch (AddressNotFoundException anfe) {
+            session.transfer(flowFile, REL_NOT_FOUND);
+
+            switch (logLevel) {
+                case info:
+                    getLogger().info("Address not found in the database", anfe);
+                    break;
+                case warn:
+                    getLogger().warn("Address not found in the database", anfe);
+                    break;
+                case error:
+                    getLogger().error("Address not found in the database", anfe);
+                    break;
+                case debug:
+                default:
+                    if(getLogger().isDebugEnabled()) {
+                        getLogger().debug("Address not found in the database", anfe);
+                    }

Review Comment:
   The `isDebugEnabled()` conditional does not seem necessary since the message does not require any formatting, and the standard logging handlers should filter this operation.
   ```suggestion
                       getLogger().debug("Address not found in the database", anfe);
   ```



##########
nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-processors/src/main/java/org/apache/nifi/processors/AbstractEnrichIP.java:
##########
@@ -70,6 +70,16 @@ public abstract class AbstractEnrichIP extends AbstractProcessor {
             .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(AttributeExpression.ResultType.STRING))
             .build();
 
+    public static final PropertyDescriptor LOG_LEVEL = new PropertyDescriptor.Builder()
+            .name("log-level")
+            .displayName("Log Level")

Review Comment:
   Recommend using the same name and displayName values.
   ```suggestion
               .name("Log Level")
               .displayName("Log Level")
   ```



##########
nifi-nar-bundles/nifi-enrich-bundle/nifi-enrich-processors/src/main/java/org/apache/nifi/processors/AbstractEnrichIP.java:
##########
@@ -80,6 +90,10 @@ public abstract class AbstractEnrichIP extends AbstractProcessor {
             .description("Where to route flow files after unsuccessfully enriching attributes because no data was found")
             .build();
 
+    enum MessageLogLevel {
+        debug, info, warn, error
+    }

Review Comment:
   Is there a reason for using lowercase values? Recommend using the conventional uppercase:
   ```suggestion
       enum MessageLogLevel {
           DEBUG, INFO, WARN, ERROR
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12253 NIFI-12230 - Add configurable log level for IP not found and fix GeoEnrichIPRecord [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory closed pull request #7909: NIFI-12253 NIFI-12230 - Add configurable log level for IP not found and fix GeoEnrichIPRecord
URL: https://github.com/apache/nifi/pull/7909


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12253 NIFI-12230 - Add configurable log level for IP not found and fix GeoEnrichIPRecord [nifi]

Posted by "pvillard31 (via GitHub)" <gi...@apache.org>.
pvillard31 commented on PR #7909:
URL: https://github.com/apache/nifi/pull/7909#issuecomment-1772350548

   Thanks for the review @exceptionfactory - I addressed your comments.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org