[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2018-02-01 Thread vakshorton
Github user vakshorton closed the pull request at:

https://github.com/apache/nifi/pull/2181


---


[GitHub] nifi issue #2310: NIFI-4428: Add PutDruidRecord processor and DruidTranquili...

2017-12-28 Thread vakshorton
Github user vakshorton commented on the issue:

https://github.com/apache/nifi/pull/2310
  
@MikeThomsen There is an indexing service that works with Kafka. However, 
for high volume use cases, this requires a lot of Kafka resources just to 
ingest data into Druid. Presumably, all that data would have already flowed 
through and been processed by Nifi. Providing the capability to send the data 
directly into Druid can really reduce the required hardware resources, 
management overhead, and usage complexity.


---


[GitHub] nifi issue #2310: NIFI-4428: Add PutDruidRecord processor and DruidTranquili...

2017-12-21 Thread vakshorton
Github user vakshorton commented on the issue:

https://github.com/apache/nifi/pull/2310
  
@pvillard31 You are likely seeing a lot of dropped events because the 
timestamps in the events are out of synch with the server clock. If your 
segment granularity is set to 10 minutes, late window set to 1 minute and the 
event timestamp is more than 11 minutes out of synch with the server time, that 
data is considered "late" (since the target index task will have closed). What 
kind of ingestion rates on what input volume? Are you seeing a lot of queuing? 
Can you check your middle manager configuration/resource allocation?


---


[GitHub] nifi issue #2181: NIFI-4428: - Implement PutDruid Processor and Controller

2017-11-14 Thread vakshorton
Github user vakshorton commented on the issue:

https://github.com/apache/nifi/pull/2181
  
@mattyb149 As Druid is optimized for OLAP it does not work as an OLTP 
datastore, The REST API of Druid is for querying and obtaining meta data (like 
segment schema and time interval), it does not support writes. That is mainly 
because writes in Druid can only happen after a configured quantity of data 
(Segment Granularity Spec) has been indexed and organized into a storage 
segment (schema, bitmap index, aggregate metrics, compression). Only an 
Indexing job can create a segment (either batch or realtime). Realtime indexing 
jobs can be created in one of two ways. 1.) Pull via a Firehose (Druid Aware 
Pull API) created to read the stream source, controlled by a Druid Realtime 
Node (like the Kafka Indexing Service). 2.) Push via Tranquility (Druid 
Indexing API) from stream source to Druid Overlord and then MiddleManager Nodes 
that will make the data immediately queryable while indexing it for storage as 
a segment. Since the goal is to push data from Nifi into Druid, Tranquility 
seems 
 like the best option.


---


[GitHub] nifi issue #2181: NIFI-4428: - Implement PutDruid Processor and Controller

2017-11-14 Thread vakshorton
Github user vakshorton commented on the issue:

https://github.com/apache/nifi/pull/2181
  
@MikeThomsen quick start instructions are here 
[http://druid.io/docs/latest/tutorials/quickstart.html](url). Let me know if 
you have questions.


---


[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144169649
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/main/java/org/apache/nifi/processors/PutDruid.java
 ---
@@ -0,0 +1,206 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.annotation.behavior.SideEffectFree;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.InputStreamCallback;
+import org.apache.nifi.stream.io.StreamUtils;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import org.apache.nifi.controller.api.DruidTranquilityService;
+import com.metamx.tranquility.tranquilizer.MessageDroppedException;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.twitter.util.Await;
+import com.twitter.util.Future;
+import com.twitter.util.FutureEventListener;
+
+import scala.runtime.BoxedUnit;
+
+@SideEffectFree
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Sends events to Apache Druid for Indexing. "
+   + "Leverages Druid Tranquility 
Controller service."
+   + "Incoming flow files are 
expected to contain 1 or many JSON objects, one JSON object per line")
+public class PutDruid extends AbstractSessionFactoryProcessor {
+
+private List properties;
+private Set relationships;
+private final Map messageStatus = new 
HashMap();
+
+public static final PropertyDescriptor DRUID_TRANQUILITY_SERVICE = new 
PropertyDescriptor.Builder()
+.name("druid_tranquility_service")
+.description("Tranquility Service to use for sending events to 
Druid")
+.required(true)
+.identifiesControllerService(DruidTranquilityService.class)
+.build();
+
+public static final Relationship REL_SUCCESS = new 
Relationship.Builder()
+.name("SUCCESS")
+.description("Succes relationship")
+.build();
+
+public static final Relationship REL_FAIL = new Relationship.Builder()
+.name("FAIL")
+.description("FlowFiles are routed to this relationship when 
they cannot be parsed")
+.build();
+
+public static final Relationship REL_DROPPED = new 
Relationship.Builder()
+.name("DROPPED")
+.description("FlowFiles are routed to this relationship when 
they are outside of the configured time window, timestamp format is invalid, 
ect...")
+.build();
+
+public void init(final ProcessorInitializationContext context){
+List properties = 

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144168218
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/main/java/org/apache/nifi/processors/PutDruid.java
 ---
@@ -0,0 +1,206 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.annotation.behavior.SideEffectFree;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.InputStreamCallback;
+import org.apache.nifi.stream.io.StreamUtils;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import org.apache.nifi.controller.api.DruidTranquilityService;
+import com.metamx.tranquility.tranquilizer.MessageDroppedException;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.twitter.util.Await;
+import com.twitter.util.Future;
+import com.twitter.util.FutureEventListener;
+
+import scala.runtime.BoxedUnit;
+
+@SideEffectFree
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Sends events to Apache Druid for Indexing. "
+   + "Leverages Druid Tranquility 
Controller service."
+   + "Incoming flow files are 
expected to contain 1 or many JSON objects, one JSON object per line")
+public class PutDruid extends AbstractSessionFactoryProcessor {
+
+private List properties;
+private Set relationships;
+private final Map messageStatus = new 
HashMap();
+
+public static final PropertyDescriptor DRUID_TRANQUILITY_SERVICE = new 
PropertyDescriptor.Builder()
+.name("druid_tranquility_service")
+.description("Tranquility Service to use for sending events to 
Druid")
+.required(true)
+.identifiesControllerService(DruidTranquilityService.class)
+.build();
+
+public static final Relationship REL_SUCCESS = new 
Relationship.Builder()
+.name("SUCCESS")
+.description("Succes relationship")
+.build();
+
+public static final Relationship REL_FAIL = new Relationship.Builder()
+.name("FAIL")
+.description("FlowFiles are routed to this relationship when 
they cannot be parsed")
+.build();
+
+public static final Relationship REL_DROPPED = new 
Relationship.Builder()
+.name("DROPPED")
+.description("FlowFiles are routed to this relationship when 
they are outside of the configured time window, timestamp format is invalid, 
ect...")
+.build();
+
+public void init(final ProcessorInitializationContext context){
+List properties = 

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144166799
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/main/java/org/apache/nifi/processors/PutDruid.java
 ---
@@ -0,0 +1,206 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.annotation.behavior.SideEffectFree;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.InputStreamCallback;
+import org.apache.nifi.stream.io.StreamUtils;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import org.apache.nifi.controller.api.DruidTranquilityService;
+import com.metamx.tranquility.tranquilizer.MessageDroppedException;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.twitter.util.Await;
+import com.twitter.util.Future;
+import com.twitter.util.FutureEventListener;
+
+import scala.runtime.BoxedUnit;
+
+@SideEffectFree
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Sends events to Apache Druid for Indexing. "
+   + "Leverages Druid Tranquility 
Controller service."
+   + "Incoming flow files are 
expected to contain 1 or many JSON objects, one JSON object per line")
+public class PutDruid extends AbstractSessionFactoryProcessor {
+
+private List properties;
+private Set relationships;
+private final Map messageStatus = new 
HashMap();
+
+public static final PropertyDescriptor DRUID_TRANQUILITY_SERVICE = new 
PropertyDescriptor.Builder()
+.name("druid_tranquility_service")
+.description("Tranquility Service to use for sending events to 
Druid")
+.required(true)
+.identifiesControllerService(DruidTranquilityService.class)
+.build();
+
+public static final Relationship REL_SUCCESS = new 
Relationship.Builder()
+.name("SUCCESS")
+.description("Succes relationship")
+.build();
+
+public static final Relationship REL_FAIL = new Relationship.Builder()
+.name("FAIL")
+.description("FlowFiles are routed to this relationship when 
they cannot be parsed")
+.build();
+
+public static final Relationship REL_DROPPED = new 
Relationship.Builder()
+.name("DROPPED")
+.description("FlowFiles are routed to this relationship when 
they are outside of the configured time window, timestamp format is invalid, 
ect...")
+.build();
+
+public void init(final ProcessorInitializationContext context){
+List properties = 

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144165948
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/DruidTranquilityController.java
 ---
@@ -0,0 +1,416 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.controller;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.InitializationException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.joda.time.DateTime;
+import org.joda.time.Period;
+
+import com.metamx.common.Granularity;
+import com.metamx.tranquility.beam.Beam;
+import com.metamx.tranquility.beam.ClusteredBeamTuning;
+import com.metamx.tranquility.druid.DruidBeamConfig;
+import com.metamx.tranquility.druid.DruidBeams;
+import com.metamx.tranquility.druid.DruidDimensions;
+import com.metamx.tranquility.druid.DruidEnvironment;
+import com.metamx.tranquility.druid.DruidLocation;
+import com.metamx.tranquility.druid.DruidRollup;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.metamx.tranquility.typeclass.Timestamper;
+
+import io.druid.data.input.impl.TimestampSpec;
+import io.druid.granularity.QueryGranularity;
+import io.druid.query.aggregation.AggregatorFactory;
+import io.druid.query.aggregation.CountAggregatorFactory;
+import io.druid.query.aggregation.DoubleMaxAggregatorFactory;
+import io.druid.query.aggregation.DoubleMinAggregatorFactory;
+import io.druid.query.aggregation.DoubleSumAggregatorFactory;
+import io.druid.query.aggregation.LongMaxAggregatorFactory;
+import io.druid.query.aggregation.LongMinAggregatorFactory;
+import io.druid.query.aggregation.LongSumAggregatorFactory;
+
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Asyncronously sends flowfiles to Druid Indexing 
Task using Tranquility API. "
+   + "If aggregation and roll-up of data is required, an 
Aggregator JSON desriptor needs to be provided."
+   + "Details on how desribe aggregation using JSON can be found 
at: http://druid.io/docs/latest/querying/aggregations.html";)
+public class DruidTranquilityController extends AbstractControllerService 
implements org.apache.nifi.controller.api.DruidTranquilityService{
+   private String firehosePattern = "druid:firehose:%s";
+   private int clusterPartitions = 1;
+private int clusterReplication = 1 ;
+private String indexRetryPeriod = "PT10M";
+
+private Tranquilizer tranquilizer = null;
+
+   public static final PropertyDescriptor DATASOURCE = new 
PropertyDescriptor.Builder()
+.name("data_source")
+.description("Druid Data Source")
+.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+.required(true)
+.build();
+   
+   public static final PropertyDescriptor CONNECT_STRING = new 
PropertyDescriptor.Builder()
+  

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144165848
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/DruidTranquilityController.java
 ---
@@ -0,0 +1,416 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.controller;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.InitializationException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.joda.time.DateTime;
+import org.joda.time.Period;
+
+import com.metamx.common.Granularity;
+import com.metamx.tranquility.beam.Beam;
+import com.metamx.tranquility.beam.ClusteredBeamTuning;
+import com.metamx.tranquility.druid.DruidBeamConfig;
+import com.metamx.tranquility.druid.DruidBeams;
+import com.metamx.tranquility.druid.DruidDimensions;
+import com.metamx.tranquility.druid.DruidEnvironment;
+import com.metamx.tranquility.druid.DruidLocation;
+import com.metamx.tranquility.druid.DruidRollup;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.metamx.tranquility.typeclass.Timestamper;
+
+import io.druid.data.input.impl.TimestampSpec;
+import io.druid.granularity.QueryGranularity;
+import io.druid.query.aggregation.AggregatorFactory;
+import io.druid.query.aggregation.CountAggregatorFactory;
+import io.druid.query.aggregation.DoubleMaxAggregatorFactory;
+import io.druid.query.aggregation.DoubleMinAggregatorFactory;
+import io.druid.query.aggregation.DoubleSumAggregatorFactory;
+import io.druid.query.aggregation.LongMaxAggregatorFactory;
+import io.druid.query.aggregation.LongMinAggregatorFactory;
+import io.druid.query.aggregation.LongSumAggregatorFactory;
+
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Asyncronously sends flowfiles to Druid Indexing 
Task using Tranquility API. "
+   + "If aggregation and roll-up of data is required, an 
Aggregator JSON desriptor needs to be provided."
+   + "Details on how desribe aggregation using JSON can be found 
at: http://druid.io/docs/latest/querying/aggregations.html";)
+public class DruidTranquilityController extends AbstractControllerService 
implements org.apache.nifi.controller.api.DruidTranquilityService{
+   private String firehosePattern = "druid:firehose:%s";
+   private int clusterPartitions = 1;
+private int clusterReplication = 1 ;
+private String indexRetryPeriod = "PT10M";
+
+private Tranquilizer tranquilizer = null;
+
+   public static final PropertyDescriptor DATASOURCE = new 
PropertyDescriptor.Builder()
+.name("data_source")
+.description("Druid Data Source")
+.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+.required(true)
+.build();
+   
+   public static final PropertyDescriptor CONNECT_STRING = new 
PropertyDescriptor.Builder()
+  

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144165881
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/DruidTranquilityController.java
 ---
@@ -0,0 +1,416 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.controller;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.InitializationException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.joda.time.DateTime;
+import org.joda.time.Period;
+
+import com.metamx.common.Granularity;
+import com.metamx.tranquility.beam.Beam;
+import com.metamx.tranquility.beam.ClusteredBeamTuning;
+import com.metamx.tranquility.druid.DruidBeamConfig;
+import com.metamx.tranquility.druid.DruidBeams;
+import com.metamx.tranquility.druid.DruidDimensions;
+import com.metamx.tranquility.druid.DruidEnvironment;
+import com.metamx.tranquility.druid.DruidLocation;
+import com.metamx.tranquility.druid.DruidRollup;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.metamx.tranquility.typeclass.Timestamper;
+
+import io.druid.data.input.impl.TimestampSpec;
+import io.druid.granularity.QueryGranularity;
+import io.druid.query.aggregation.AggregatorFactory;
+import io.druid.query.aggregation.CountAggregatorFactory;
+import io.druid.query.aggregation.DoubleMaxAggregatorFactory;
+import io.druid.query.aggregation.DoubleMinAggregatorFactory;
+import io.druid.query.aggregation.DoubleSumAggregatorFactory;
+import io.druid.query.aggregation.LongMaxAggregatorFactory;
+import io.druid.query.aggregation.LongMinAggregatorFactory;
+import io.druid.query.aggregation.LongSumAggregatorFactory;
+
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Asyncronously sends flowfiles to Druid Indexing 
Task using Tranquility API. "
+   + "If aggregation and roll-up of data is required, an 
Aggregator JSON desriptor needs to be provided."
+   + "Details on how desribe aggregation using JSON can be found 
at: http://druid.io/docs/latest/querying/aggregations.html";)
+public class DruidTranquilityController extends AbstractControllerService 
implements org.apache.nifi.controller.api.DruidTranquilityService{
+   private String firehosePattern = "druid:firehose:%s";
+   private int clusterPartitions = 1;
+private int clusterReplication = 1 ;
+private String indexRetryPeriod = "PT10M";
+
+private Tranquilizer tranquilizer = null;
+
+   public static final PropertyDescriptor DATASOURCE = new 
PropertyDescriptor.Builder()
+.name("data_source")
+.description("Druid Data Source")
+.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+.required(true)
+.build();
+   
+   public static final PropertyDescriptor CONNECT_STRING = new 
PropertyDescriptor.Builder()
+  

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144165757
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service-api-nar/pom.xml
 ---
@@ -0,0 +1,37 @@
+
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  4.0.0
+  
+   org.apache.nifi
+   nifi-druid-bundle
+   1.0-SNAPSHOT
+  
+  
+  nifi-druid-controller-service-api-nar
+  nar
+  
+   
+1.1.1
--- End diff --

The latest nifi binaries available in the public Maven repo is 1.3.0. 
Should I keep 1.5.0-SNAPSHOT even though it will show up as not found when the 
IDE does its checks?


---


[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144165557
  
--- Diff: nifi-nar-bundles/nifi-druid-bundle/nifi-druid-bundle-nar/pom.xml 
---
@@ -0,0 +1,39 @@
+
+
+http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+  4.0.0
+  
+   org.apache.nifi
+   nifi-druid-bundle
+   1.0-SNAPSHOT
--- End diff --

I changed all of the bundle references to 1.5.0-SNAPSHOT. You will see it 
when I push the update.


---


[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144160007
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-processors/src/main/java/org/apache/nifi/processors/PutDruid.java
 ---
@@ -0,0 +1,206 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.processors;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.nifi.annotation.behavior.SideEffectFree;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.processor.AbstractSessionFactoryProcessor;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.processor.ProcessorInitializationContext;
+import org.apache.nifi.processor.Relationship;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.processor.io.InputStreamCallback;
+import org.apache.nifi.stream.io.StreamUtils;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+
+import org.apache.nifi.controller.api.DruidTranquilityService;
+import com.metamx.tranquility.tranquilizer.MessageDroppedException;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.twitter.util.Await;
+import com.twitter.util.Future;
+import com.twitter.util.FutureEventListener;
+
+import scala.runtime.BoxedUnit;
+
+@SideEffectFree
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Sends events to Apache Druid for Indexing. "
+   + "Leverages Druid Tranquility 
Controller service."
+   + "Incoming flow files are 
expected to contain 1 or many JSON objects, one JSON object per line")
+public class PutDruid extends AbstractSessionFactoryProcessor {
+
+private List properties;
+private Set relationships;
+private final Map messageStatus = new 
HashMap();
+
+public static final PropertyDescriptor DRUID_TRANQUILITY_SERVICE = new 
PropertyDescriptor.Builder()
+.name("druid_tranquility_service")
+.description("Tranquility Service to use for sending events to 
Druid")
+.required(true)
+.identifiesControllerService(DruidTranquilityService.class)
+.build();
+
+public static final Relationship REL_SUCCESS = new 
Relationship.Builder()
+.name("SUCCESS")
+.description("Succes relationship")
+.build();
+
+public static final Relationship REL_FAIL = new Relationship.Builder()
+.name("FAIL")
+.description("FlowFiles are routed to this relationship when 
they cannot be parsed")
+.build();
+
+public static final Relationship REL_DROPPED = new 
Relationship.Builder()
+.name("DROPPED")
+.description("FlowFiles are routed to this relationship when 
they are outside of the configured time window, timestamp format is invalid, 
ect...")
+.build();
+
+public void init(final ProcessorInitializationContext context){
+List properties = 

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-10-11 Thread vakshorton
Github user vakshorton commented on a diff in the pull request:

https://github.com/apache/nifi/pull/2181#discussion_r144159450
  
--- Diff: 
nifi-nar-bundles/nifi-druid-bundle/nifi-druid-controller-service/src/main/java/org/apache/nifi/controller/DruidTranquilityController.java
 ---
@@ -0,0 +1,416 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.controller;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.apache.nifi.annotation.documentation.CapabilityDescription;
+import org.apache.nifi.annotation.documentation.Tags;
+import org.apache.nifi.annotation.lifecycle.OnEnabled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.controller.AbstractControllerService;
+import org.apache.nifi.controller.ConfigurationContext;
+import org.apache.nifi.processor.util.StandardValidators;
+import org.apache.nifi.reporting.InitializationException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.joda.time.DateTime;
+import org.joda.time.Period;
+
+import com.metamx.common.Granularity;
+import com.metamx.tranquility.beam.Beam;
+import com.metamx.tranquility.beam.ClusteredBeamTuning;
+import com.metamx.tranquility.druid.DruidBeamConfig;
+import com.metamx.tranquility.druid.DruidBeams;
+import com.metamx.tranquility.druid.DruidDimensions;
+import com.metamx.tranquility.druid.DruidEnvironment;
+import com.metamx.tranquility.druid.DruidLocation;
+import com.metamx.tranquility.druid.DruidRollup;
+import com.metamx.tranquility.tranquilizer.Tranquilizer;
+import com.metamx.tranquility.typeclass.Timestamper;
+
+import io.druid.data.input.impl.TimestampSpec;
+import io.druid.granularity.QueryGranularity;
+import io.druid.query.aggregation.AggregatorFactory;
+import io.druid.query.aggregation.CountAggregatorFactory;
+import io.druid.query.aggregation.DoubleMaxAggregatorFactory;
+import io.druid.query.aggregation.DoubleMinAggregatorFactory;
+import io.druid.query.aggregation.DoubleSumAggregatorFactory;
+import io.druid.query.aggregation.LongMaxAggregatorFactory;
+import io.druid.query.aggregation.LongMinAggregatorFactory;
+import io.druid.query.aggregation.LongSumAggregatorFactory;
+
+@Tags({"Druid","Timeseries","OLAP","ingest"})
+@CapabilityDescription("Asyncronously sends flowfiles to Druid Indexing 
Task using Tranquility API. "
+   + "If aggregation and roll-up of data is required, an 
Aggregator JSON desriptor needs to be provided."
+   + "Details on how desribe aggregation using JSON can be found 
at: http://druid.io/docs/latest/querying/aggregations.html";)
+public class DruidTranquilityController extends AbstractControllerService 
implements org.apache.nifi.controller.api.DruidTranquilityService{
+   private String firehosePattern = "druid:firehose:%s";
+   private int clusterPartitions = 1;
+private int clusterReplication = 1 ;
+private String indexRetryPeriod = "PT10M";
+
+private Tranquilizer tranquilizer = null;
+
+   public static final PropertyDescriptor DATASOURCE = new 
PropertyDescriptor.Builder()
+.name("data_source")
+.description("Druid Data Source")
+.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+.required(true)
+.build();
+   
+   public static final PropertyDescriptor CONNECT_STRING = new 
PropertyDescriptor.Builder()
+  

[GitHub] nifi pull request #2181: NIFI-4428: - Implement PutDruid Processor and Contr...

2017-09-27 Thread vakshorton
GitHub user vakshorton opened a pull request:

https://github.com/apache/nifi/pull/2181

NIFI-4428: - Implement PutDruid Processor and Controller

Thank you for submitting a contribution to Apache NiFi.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

### For all changes:
- [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
 in the commit message?

- [ ] Does your PR title start with NIFI- where  is the JIRA number 
you are trying to resolve? Pay particular attention to the hyphen "-" character.

- [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?

- [ ] Is your initial contribution a single, squashed commit?

### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via mvn 
-Pcontrib-check clean install at the root nifi folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)? 
- [ ] If applicable, have you updated the LICENSE file, including the main 
LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main 
NOTICE file found under nifi-assembly?
- [ ] If adding new Properties, have you added .displayName in addition to 
.name (programmatic access) for each of the new properties?

### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in 
which it is rendered?

### Note:
Please ensure that once the PR is submitted, you check travis-ci for build 
issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/vakshorton/nifi master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/nifi/pull/2181.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2181


commit f71286a44843d1f322ff2d8e2bfee80b6ac0ca69
Author: vvaks 
Date:   2017-09-27T17:23:23Z

NIFI-4428: - Implement PutDruid Processor and Controller




---