Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2562#discussion_r178794242
  
    --- Diff: 
nifi-nar-bundles/nifi-influxdb-bundle/nifi-influxdb-processors/src/main/java/org/apache/nifi/processors/influxdb/ExecuteInfluxDBQuery.java
 ---
    @@ -209,32 +204,40 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
     
                 if ( ! result.hasError() ) {
                     outgoingFlowFile = session.putAttribute(outgoingFlowFile, 
INFLUX_DB_EXECUTED_QUERY, String.valueOf(query));
    +                session.getProvenanceReporter().send(outgoingFlowFile, 
makeProvenanceUrl(context, database, outgoingFlowFile),
    +                        (endTimeMillis - startTimeMillis));
                     session.transfer(outgoingFlowFile, REL_SUCCESS);
                 } else {
                     outgoingFlowFile = populateErrorAttributes(session, 
outgoingFlowFile, query, result.getError());
                     session.transfer(outgoingFlowFile, REL_FAILURE);
                 }
     
    -            session.getProvenanceReporter().send(outgoingFlowFile, 
makeProvenanceUrl(context, database),
    -                (endTimeMillis - startTimeMillis));
             } catch (Exception exception) {
                 outgoingFlowFile = populateErrorAttributes(session, 
outgoingFlowFile, query, exception.getMessage());
                 if ( exception.getCause() instanceof SocketTimeoutException ) {
    -                getLogger().error("Failed to read from influxDB due 
SocketTimeoutException to {} and retrying",
    +                getLogger().error("Failed to read from InfluxDB due 
SocketTimeoutException to {} and retrying",
                             new 
Object[]{exception.getCause().getLocalizedMessage()}, exception.getCause());
                     session.transfer(outgoingFlowFile, REL_RETRY);
                 } else {
    -                getLogger().error("Failed to read from influxDB due to {}",
    +                getLogger().error("Failed to read from InfluxDB due to {}",
                             new Object[]{exception.getLocalizedMessage()}, 
exception);
                     session.transfer(outgoingFlowFile, REL_FAILURE);
                 }
                 context.yield();
             }
         }
     
    -    protected String makeProvenanceUrl(final ProcessContext context, 
String database) {
    +    protected String getQuery(final ProcessSession session, Charset 
charset, FlowFile incomingFlowFile)
    +            throws IOException {
    --- End diff --
    
    You don't have to redo it that way, it's just a suggestion.


---

Reply via email to