You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/03/15 15:38:49 UTC

[GitHub] markusthoemmes commented on a change in pull request #3421: Add ElasticSearch Log Store

markusthoemmes commented on a change in pull request #3421: Add ElasticSearch Log Store
URL: https://github.com/apache/incubator-openwhisk/pull/3421#discussion_r174373875
 
 

 ##########
 File path: common/scala/src/main/scala/whisk/core/containerpool/logging/ElasticSearchRestClient.scala
 ##########
 @@ -0,0 +1,98 @@
+/*
+ * 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 whisk.core.containerpool.logging
+
+import scala.concurrent.Future
+
+import akka.actor.ActorSystem
+import akka.http.scaladsl.model._
+import akka.http.scaladsl.model.headers.Accept
+import akka.stream.scaladsl.Flow
+
+import scala.concurrent.Promise
+import scala.util.Try
+
+import spray.json._
+import spray.json.DefaultJsonProtocol._
+
+import whisk.common.Logging
+import whisk.http.PoolingRestClient
+
+// Schema of query result order in ES
+case class EsQueryOrder(order: String)
+case class EsQueryTimestamp(timestamp: EsQueryOrder)
+
+// Schema of queries in ES
+case class EsQueryTerm(term: JsObject)
+case class EsQueryValue(query: String)
+case class EsQueryString(queryString: EsQueryValue)
+case class EsQuery(query: JsValue, sort: Option[Array[JsValue]] = None)
+
+object ElasticSearchJsonProtocol extends DefaultJsonProtocol {
+  implicit val esQueryOrderFormat = jsonFormat1(EsQueryOrder.apply)
+  implicit val esQueryTimestampFormat = jsonFormat(EsQueryTimestamp.apply _, "@timestamp")
+  implicit val esQueryTermFormat = jsonFormat1(EsQueryTerm.apply)
+  implicit val esQueryValueFormat = jsonFormat1(EsQueryValue.apply)
+  implicit val esQueryStringFormat = jsonFormat(EsQueryString.apply _, "query_string")
+  implicit val esQueryFormat = jsonFormat(EsQuery.apply, "query", "sort")
+}
 
 Review comment:
   Neat! Can we consolidate the classes below here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services