From cfa6edfef4715d243d3fefaeb65da5674b007c75 Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Thu, 4 Jan 2024 10:43:18 +0800 Subject: [PATCH 1/8] [KYUUBI #5944][Improvement] Introduce Prometheus and Grafana for Kyuubi Playground --- docker/playground/.env | 2 ++ docker/playground/README.md | 2 ++ docker/playground/compose.yml | 21 +++++++++++++++++++ .../grafana/datasource/prometheus.yaml | 10 +++++++++ docker/playground/prometheus/prometheus.yml | 4 ++++ 5 files changed, 39 insertions(+) create mode 100644 docker/playground/grafana/datasource/prometheus.yaml create mode 100644 docker/playground/prometheus/prometheus.yml diff --git a/docker/playground/.env b/docker/playground/.env index e8446fd56c9..3919fe5dcbf 100644 --- a/docker/playground/.env +++ b/docker/playground/.env @@ -28,3 +28,5 @@ SPARK_VERSION=3.4.2 SPARK_BINARY_VERSION=3.4 SPARK_HADOOP_VERSION=3.3.4 ZOOKEEPER_VERSION=3.6.3 +PROMETHEUS_VERSION=v2.45.2 +GRAFANA_VERSION=10.0.10 diff --git a/docker/playground/README.md b/docker/playground/README.md index 66dca2af0ab..5f6237add09 100644 --- a/docker/playground/README.md +++ b/docker/playground/README.md @@ -34,6 +34,8 @@ Kyuubi supply some built-in dataset, after Kyuubi started, you can run the follo - MinIO: http://localhost:9001 - PostgreSQL localhost:5432 (username: postgres, password: postgres) - Spark UI: http://localhost:4040 (available after Spark application launching by Kyuubi, port may be 4041, 4042... if you launch more than one Spark applications) +- Prometheus: http://localhost:9090 +- grafana: http://localhost:3000 (username: admin, password: admin) ### Shutdown diff --git a/docker/playground/compose.yml b/docker/playground/compose.yml index 362b3505be1..95ae03f7a4b 100644 --- a/docker/playground/compose.yml +++ b/docker/playground/compose.yml @@ -81,3 +81,24 @@ services: - metastore - minio - zookeeper + + prometheus: + image: prom/prometheus:${PROMETHEUS_VERSION} + container_name: prometheus + hostname: prometheus + ports: + - 9090:9090 + - 8123:8123 + volumes: + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yaml + + grafana: + image: grafana/grafana:${GRAFANA_VERSION} + container_name: grafana + hostname: grafana + ports: + - 3000:3000 + volumes: + - ./grafana/datasource/prometheus.yaml:/etc/grafana/provisioning/datasources/prometheus.yaml + depends_on: + - prometheus diff --git a/docker/playground/grafana/datasource/prometheus.yaml b/docker/playground/grafana/datasource/prometheus.yaml new file mode 100644 index 00000000000..4a12eb7508b --- /dev/null +++ b/docker/playground/grafana/datasource/prometheus.yaml @@ -0,0 +1,10 @@ +apiVersion: 1 + +datasources: +- name: prometheus + type: prometheus + url: http://prometheus:9090 + isDefault: true + access: server + editable: true + version: 1 \ No newline at end of file diff --git a/docker/playground/prometheus/prometheus.yml b/docker/playground/prometheus/prometheus.yml new file mode 100644 index 00000000000..ab0a1e4e9c8 --- /dev/null +++ b/docker/playground/prometheus/prometheus.yml @@ -0,0 +1,4 @@ +scrape_configs: + - job_name: kyuubi + static_configs: + - targets: ['kyuubi:10019'] \ No newline at end of file From 68720788e3e376d123838b0a26f32433a3a23118 Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Thu, 4 Jan 2024 10:57:57 +0800 Subject: [PATCH 2/8] add license header --- .../grafana/datasource/prometheus.yaml | 17 +++++++++++++++++ docker/playground/prometheus/prometheus.yml | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/docker/playground/grafana/datasource/prometheus.yaml b/docker/playground/grafana/datasource/prometheus.yaml index 4a12eb7508b..a4bedc70e22 100644 --- a/docker/playground/grafana/datasource/prometheus.yaml +++ b/docker/playground/grafana/datasource/prometheus.yaml @@ -1,3 +1,20 @@ +# +# 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. +# + apiVersion: 1 datasources: diff --git a/docker/playground/prometheus/prometheus.yml b/docker/playground/prometheus/prometheus.yml index ab0a1e4e9c8..73d047a60e8 100644 --- a/docker/playground/prometheus/prometheus.yml +++ b/docker/playground/prometheus/prometheus.yml @@ -1,3 +1,20 @@ +# +# 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. +# + scrape_configs: - job_name: kyuubi static_configs: From 089f8d08c6f36f9ad43d7a04489904142228f5cb Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Thu, 4 Jan 2024 10:58:50 +0800 Subject: [PATCH 3/8] eof --- docker/playground/grafana/datasource/prometheus.yaml | 2 +- docker/playground/prometheus/prometheus.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/playground/grafana/datasource/prometheus.yaml b/docker/playground/grafana/datasource/prometheus.yaml index a4bedc70e22..ee69857e18b 100644 --- a/docker/playground/grafana/datasource/prometheus.yaml +++ b/docker/playground/grafana/datasource/prometheus.yaml @@ -24,4 +24,4 @@ datasources: isDefault: true access: server editable: true - version: 1 \ No newline at end of file + version: 1 diff --git a/docker/playground/prometheus/prometheus.yml b/docker/playground/prometheus/prometheus.yml index 73d047a60e8..91218e3744b 100644 --- a/docker/playground/prometheus/prometheus.yml +++ b/docker/playground/prometheus/prometheus.yml @@ -18,4 +18,4 @@ scrape_configs: - job_name: kyuubi static_configs: - - targets: ['kyuubi:10019'] \ No newline at end of file + - targets: ['kyuubi:10019'] From f7ca4ae1c23ded54d6f74a4b46fcd7e48bf04492 Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Thu, 4 Jan 2024 11:29:49 +0800 Subject: [PATCH 4/8] fix prometheus --- docker/playground/compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/playground/compose.yml b/docker/playground/compose.yml index 95ae03f7a4b..54dc9d68ea6 100644 --- a/docker/playground/compose.yml +++ b/docker/playground/compose.yml @@ -90,7 +90,7 @@ services: - 9090:9090 - 8123:8123 volumes: - - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yaml + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml grafana: image: grafana/grafana:${GRAFANA_VERSION} From 404dd42ff00cf72777edc56ba37f82f7a04e30c1 Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Thu, 4 Jan 2024 16:22:46 +0800 Subject: [PATCH 5/8] fix comments --- docker/playground/.env | 2 +- docker/playground/compose.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/playground/.env b/docker/playground/.env index 3919fe5dcbf..c09540fc700 100644 --- a/docker/playground/.env +++ b/docker/playground/.env @@ -28,5 +28,5 @@ SPARK_VERSION=3.4.2 SPARK_BINARY_VERSION=3.4 SPARK_HADOOP_VERSION=3.3.4 ZOOKEEPER_VERSION=3.6.3 -PROMETHEUS_VERSION=v2.45.2 +PROMETHEUS_VERSION=2.45.2 GRAFANA_VERSION=10.0.10 diff --git a/docker/playground/compose.yml b/docker/playground/compose.yml index 54dc9d68ea6..1bbe7f8fa26 100644 --- a/docker/playground/compose.yml +++ b/docker/playground/compose.yml @@ -83,7 +83,8 @@ services: - zookeeper prometheus: - image: prom/prometheus:${PROMETHEUS_VERSION} + # leave `v` here for match prometheus docker image tag + image: prom/prometheus:v${PROMETHEUS_VERSION} container_name: prometheus hostname: prometheus ports: From e6efe3071c2372a53456c8af559834341a0cf4fc Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Thu, 4 Jan 2024 17:09:18 +0800 Subject: [PATCH 6/8] make grafana as anonymous --- docker/playground/compose.yml | 5 ++++- docker/playground/grafana/datasource/prometheus.yaml | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/playground/compose.yml b/docker/playground/compose.yml index 1bbe7f8fa26..35a794609e6 100644 --- a/docker/playground/compose.yml +++ b/docker/playground/compose.yml @@ -94,11 +94,14 @@ services: - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml grafana: - image: grafana/grafana:${GRAFANA_VERSION} + image: grafana/grafana-oss:${GRAFANA_VERSION} container_name: grafana hostname: grafana ports: - 3000:3000 + environment: + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin volumes: - ./grafana/datasource/prometheus.yaml:/etc/grafana/provisioning/datasources/prometheus.yaml depends_on: diff --git a/docker/playground/grafana/datasource/prometheus.yaml b/docker/playground/grafana/datasource/prometheus.yaml index ee69857e18b..c030390b01c 100644 --- a/docker/playground/grafana/datasource/prometheus.yaml +++ b/docker/playground/grafana/datasource/prometheus.yaml @@ -21,7 +21,8 @@ datasources: - name: prometheus type: prometheus url: http://prometheus:9090 - isDefault: true + orgId: 1 + isDefault: false access: server editable: true version: 1 From dbf41e37deac8cd8a6a9dbaad5a2dd5c09297b59 Mon Sep 17 00:00:00 2001 From: zwangsheng Date: Fri, 5 Jan 2024 11:36:13 +0800 Subject: [PATCH 7/8] declare metrics related config --- docker/playground/conf/kyuubi-defaults.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/playground/conf/kyuubi-defaults.conf b/docker/playground/conf/kyuubi-defaults.conf index e4a674634d4..75c28850fe0 100644 --- a/docker/playground/conf/kyuubi-defaults.conf +++ b/docker/playground/conf/kyuubi-defaults.conf @@ -27,6 +27,9 @@ kyuubi.session.engine.idle.timeout=PT5M kyuubi.operation.incremental.collect=true kyuubi.operation.progress.enabled=true +kyuubi.metrics.reporters=PROMETHEUS +kyuubi.metrics.prometheus.port=10019 + kyuubi.engine.session.initialize.sql \ show namespaces in tpcds; \ show namespaces in tpch; \ From 031deedeb63844449ed3cd40279e08537d26f514 Mon Sep 17 00:00:00 2001 From: Binjie Yang Date: Fri, 5 Jan 2024 19:28:03 +0800 Subject: [PATCH 8/8] Update docker/playground/README.md Co-authored-by: Cheng Pan --- docker/playground/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/playground/README.md b/docker/playground/README.md index 5f6237add09..04fdebb5274 100644 --- a/docker/playground/README.md +++ b/docker/playground/README.md @@ -35,7 +35,7 @@ Kyuubi supply some built-in dataset, after Kyuubi started, you can run the follo - PostgreSQL localhost:5432 (username: postgres, password: postgres) - Spark UI: http://localhost:4040 (available after Spark application launching by Kyuubi, port may be 4041, 4042... if you launch more than one Spark applications) - Prometheus: http://localhost:9090 -- grafana: http://localhost:3000 (username: admin, password: admin) +- Grafana: http://localhost:3000 (username: admin, password: admin) ### Shutdown