alexott commented on a change in pull request #3640: [ZEPPELIN-4602] Added 
initial version of InfluxDB interpreter
URL: https://github.com/apache/zeppelin/pull/3640#discussion_r410890756
 
 

 ##########
 File path: 
influxdb/src/main/java/org/apache/zeppelin/influxdb/InfluxDBInterpreter.java
 ##########
 @@ -0,0 +1,203 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.zeppelin.influxdb;
+
+import java.util.Properties;
+import java.util.StringJoiner;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+import com.influxdb.LogLevel;
+import com.influxdb.client.InfluxDBClient;
+import com.influxdb.client.InfluxDBClientFactory;
+import com.influxdb.client.InfluxDBClientOptions;
+import com.influxdb.client.QueryApi;
+import org.apache.zeppelin.interpreter.AbstractInterpreter;
+import org.apache.zeppelin.interpreter.ZeppelinContext;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterException;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+
+/**
+ * <a href="https://v2.docs.influxdata.com/v2.0/";>InfluxDB 2.0</a> interpreter 
for Zeppelin.
+ * It uses /v2/query API, query is written in Flux Language.
+ * <p>
+ * How to use: <br/>
+ * <pre>
+ * {@code
+ * %influxdb
+ * from(bucket: "my-bucket")
+ *   |> range(start: -5m)
+ *   |> filter(fn: (r) => r._measurement == "cpu")
+ *   |> filter(fn: (r) => r._field == "usage_user")
+ *   |> filter(fn: (r) => r.cpu == "cpu-total")
+ * }
+ * </pre>
+ * </p>
+ */
+public class InfluxDBInterpreter extends AbstractInterpreter {
+
+  static final String INFLUXDB_API_URL_PROPERTY = "influxdb.url";
+  static final String INFLUXDB_TOKEN_PROPERTY = "influxdb.token";
+  static final String INFLUXDB_ORG_PROPERTY = "influxdb.org";
+  private static final String INFLUXDB_LOGLEVEL_PROPERTY = "influxdb.logLevel";
+
+  private static final String TABLE_MAGIC_TAG = "%table ";
+  private static final String WHITESPACE = " ";
+  private static final String NEWLINE = "\n";
+  private static final String TAB = "\t";
+  static final String EMPTY_COLUMN_VALUE = "";
+
+  InfluxDBClient client;
+  QueryApi queryApi;
 
 Review comment:
   does it make sense to mark it as `volatile` ?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to