Commit ddf44534 authored by Leonardo Menezes's avatar Leonardo Menezes
Browse files

support specifying desired metrics/flags for nodes stats/info calls

parent b8ebf4c2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -18,12 +18,12 @@ class ClusterOverviewController @Inject()(val authentication: AuthenticationModu
    Future.sequence(
      Seq(
        client.clusterState(request.target),
        client.nodesStats(request.target),
        client.nodesStats(Seq("jvm","fs","os","process"), request.target),
        client.indicesStats(request.target),
        client.clusterSettings(request.target),
        client.aliases(request.target),
        client.clusterHealth(request.target),
        client.nodes(request.target),
        client.nodes(Seq("os","jvm"), request.target),
        client.main(request.target)
      )
    ).map { responses =>
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ trait ElasticClient {

  def indicesStats(target: ElasticServer): Future[ElasticResponse]

  def nodesStats(target: ElasticServer): Future[ElasticResponse]
  def nodesStats(stats: Seq[String], target: ElasticServer): Future[ElasticResponse]

  def nodeStats(node: String, target: ElasticServer): Future[ElasticResponse]

@@ -23,7 +23,7 @@ trait ElasticClient {

  def clusterHealth(target: ElasticServer): Future[ElasticResponse]

  def nodes(target: ElasticServer): Future[ElasticResponse]
  def nodes(flags: Seq[String], target: ElasticServer): Future[ElasticResponse]

  def closeIndex(index: String, target: ElasticServer): Future[ElasticResponse]

+4 −5
Original line number Diff line number Diff line
@@ -25,8 +25,8 @@ class HTTPElasticClient @Inject()(client: WSClient) extends ElasticClient {
    execute(s"${target.host}$path", "GET", None, target.authentication)
  }

  def nodesStats(target: ElasticServer) = {
    val path = "/_nodes/stats/jvm,fs,os,process"
  def nodesStats(stats: Seq[String], target: ElasticServer) = {
    val path = s"/_nodes/stats/${stats.mkString(",")}"
    execute(s"${target.host}$path", "GET", None, target.authentication)
  }

@@ -50,8 +50,8 @@ class HTTPElasticClient @Inject()(client: WSClient) extends ElasticClient {
    execute(s"${target.host}$path", "GET", None, target.authentication)
  }

  def nodes(target: ElasticServer) = {
    val path = "/_nodes/_all/os,jvm"
  def nodes(flags: Seq[String], target: ElasticServer) = {
    val path = s"/_nodes/_all/${flags.mkString(",")}"
    execute(s"${target.host}$path", "GET", None, target.authentication)
  }

@@ -70,7 +70,6 @@ class HTTPElasticClient @Inject()(client: WSClient) extends ElasticClient {
    execute(s"${target.host}$path", "POST", None, target.authentication)
  }


  def forceMerge(index: String, target: ElasticServer) = {
    val path = s"/$index/_forcemerge"
    execute(s"${target.host}$path", "POST", None, target.authentication)