Hello Zoltan Chovan, Zoltan Martonka, Alexey Serbin, Attila Bukor, Kudu 
Jenkins, Wang Xixu,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/21723

to look at the new patch set (#6).

Change subject: Add Prometheus HTTP service discovery
......................................................................

Add Prometheus HTTP service discovery

Prometheus HTTP service discovery enables automatic discovery of all
Kudu Master and TServer instances. This makes setting up monitoring for
Kudu through Prometheus much easier.

This patch implements a new endpoint: '/prometheus-sd' on Master
servers. This returns the Kudu Master and TServers, according to the
Prometheus HTTP SD format [1], [2].
For example running 3 Master and 3 TServers locally, the
'/prometheus-sd' endpoint returns the following JSON:

[
  {
    "targets": [
      "127.0.0.1:8765"
    ],
    "labels": {
      "job": "Kudu",
      "group": "masters",
      "cluster_id": "d3b1684e56b744958c8534103144c896",
      "__scheme__": "http"
    }
  },
  {
    "targets": [
      "127.0.0.1:8767"
    ],
    "labels": {
      "job": "Kudu",
      "group": "masters",
      "cluster_id": "d3b1684e56b744958c8534103144c896",
      "__scheme__": "http"
    }
  },
  {
    "targets": [
      "127.0.0.1:8769"
    ],
    "labels": {
      "job": "Kudu",
      "group": "masters",
      "cluster_id": "d3b1684e56b744958c8534103144c896",
      "__scheme__": "http"
    }
  },
  {
    "targets": [
      "127.0.0.1:9875"
    ],
    "labels": {
      "job": "Kudu",
      "group": "tservers",
      "cluster_id": "d3b1684e56b744958c8534103144c896",
      "location": "n/a",
      "__scheme__": "http"
    }
  },
  {
    "targets": [
      "127.0.0.1:9873"
    ],
    "labels": {
      "job": "Kudu",
      "group": "tservers",
      "cluster_id": "d3b1684e56b744958c8534103144c896",
      "location": "n/a",
      "__scheme__": "http"
    }
  },
  {
    "targets": [
      "127.0.0.1:9871"
    ],
    "labels": {
      "job": "Kudu",
      "group": "tservers",
      "cluster_id": "d3b1684e56b744958c8534103144c896",
      "location": "n/a",
      "__scheme__": "http"
    }
  }
]

I added basic unit test to verify the structure of the JSON. Moreover I
tested locally that after starting Kudu, Prometheus can connect
correctly. The steps of the manual testing:
1. Start Kudu
2. Start Prometheus with a custom config:
    $ prometheus --config.file=/Users/mgreber/prometheus/prometheus.yml
    The content of the config:

scrape_configs:
  - job_name: 'kudu'

    # Scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    metrics_path: '/metrics_prometheus'

    http_sd_configs:
      - url: 'http://127.0.0.1:8765/prometheus-sd'
        refresh_interval: 30s

3. Verify on the Prometheus webUI that Kudu has been discovered:
    3.1. open webUI -> Status -> Service Discovery -> check that we have
        6 active targets under Kudu.
    3.2. open webUI -> Status -> Targets -> verify that all 6 Kudu
        services are up and scraped.

[1] 
https://prometheus.io/docs/prometheus/latest/http_sd/#writing-http-service-discovery
[2] 
https://training.promlabs.com/training/relabeling/introduction-to-relabeling/hidden-labels-and-metadata/

Change-Id: I931aa72a7567c0dde43d7b7ed53a2dd0fa8bc1fe
---
M src/kudu/master/CMakeLists.txt
M src/kudu/master/master-test.cc
M src/kudu/master/master_path_handlers.cc
M src/kudu/master/master_path_handlers.h
M src/kudu/mini-cluster/webui_checker.h
M src/kudu/util/test_util.cc
6 files changed, 268 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/23/21723/6
--
To view, visit http://gerrit.cloudera.org:8080/21723
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I931aa72a7567c0dde43d7b7ed53a2dd0fa8bc1fe
Gerrit-Change-Number: 21723
Gerrit-PatchSet: 6
Gerrit-Owner: Marton Greber <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Attila Bukor <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <[email protected]>
Gerrit-Reviewer: Wang Xixu <[email protected]>
Gerrit-Reviewer: Zoltan Chovan <[email protected]>
Gerrit-Reviewer: Zoltan Martonka <[email protected]>

Reply via email to