From 566a96a019626ffd9d06dbb6915c6b70bd68b3fd Mon Sep 17 00:00:00 2001 From: Jacek Migdal Date: Fri, 3 May 2024 16:52:36 +0200 Subject: [PATCH 1/6] Preserve SVG ratio --- quesma/quesma/ui/asset/head.html | 4 ++-- quesma/quesma/ui/html_pages.go | 2 +- quesma/quesma/ui/html_panels.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/quesma/quesma/ui/asset/head.html b/quesma/quesma/ui/asset/head.html index f348757d1..cbb27c8ff 100644 --- a/quesma/quesma/ui/asset/head.html +++ b/quesma/quesma/ui/asset/head.html @@ -302,8 +302,8 @@ position: absolute; width: 60%; left: 20%; - height: 100%; - top: 0; + height: 60%; + top: 20%; } #dashboard-main svg path { diff --git a/quesma/quesma/ui/html_pages.go b/quesma/quesma/ui/html_pages.go index 72404d305..93d30236e 100644 --- a/quesma/quesma/ui/html_pages.go +++ b/quesma/quesma/ui/html_pages.go @@ -599,7 +599,7 @@ func (qmc *QuesmaManagementConsole) generateDashboard() []byte { buffer.Html(`});`) buffer.Html(`` + "\n") - buffer.Html(`` + "\n") + buffer.Html(`` + "\n") // One limitation is that, we don't update color of paths after initial draw. // They rarely change, so it's not a big deal for now. // Clickhouse -> Kibana diff --git a/quesma/quesma/ui/html_panels.go b/quesma/quesma/ui/html_panels.go index 15843c7b7..dd71c4f0a 100644 --- a/quesma/quesma/ui/html_panels.go +++ b/quesma/quesma/ui/html_panels.go @@ -334,7 +334,7 @@ func (qmc *QuesmaManagementConsole) generateDashboardTrafficElement(typeName str func (qmc *QuesmaManagementConsole) generateDashboardTrafficPanel() []byte { var buffer HtmlBuffer - buffer.Html(``) + buffer.Html(``) // Clickhouse -> Kibana if qmc.config.ReadsFromClickhouse() { From 68d3b22cd37b1159b63ae2860d0d073e937c0d37 Mon Sep 17 00:00:00 2001 From: Jacek Migdal Date: Fri, 3 May 2024 17:16:56 +0200 Subject: [PATCH 2/6] Remove menu --- quesma/quesma/ui/asset/head.html | 4 ++++ quesma/quesma/ui/html_pages.go | 11 ----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/quesma/quesma/ui/asset/head.html b/quesma/quesma/ui/asset/head.html index cbb27c8ff..20dbfc73a 100644 --- a/quesma/quesma/ui/asset/head.html +++ b/quesma/quesma/ui/asset/head.html @@ -297,6 +297,10 @@ position: absolute; } + #dashboard-main { + width: 100%; + } + #dashboard-main svg { z-index: -1; position: absolute; diff --git a/quesma/quesma/ui/html_pages.go b/quesma/quesma/ui/html_pages.go index 93d30236e..3c462d6df 100644 --- a/quesma/quesma/ui/html_pages.go +++ b/quesma/quesma/ui/html_pages.go @@ -634,17 +634,6 @@ func (qmc *QuesmaManagementConsole) generateDashboard() []byte { buffer.Html("\n") buffer.Html("\n\n\n") - buffer.Html(`") buffer.Html("\n") buffer.Html("\n") return buffer.Bytes() From cb62f9a99df72869fd3b822b04b9057b3f600f6f Mon Sep 17 00:00:00 2001 From: Jacek Migdal Date: Fri, 3 May 2024 18:28:03 +0200 Subject: [PATCH 3/6] Panel that can be resized to any dimensions. --- quesma/quesma/ui/asset/head.html | 7 ++++--- quesma/quesma/ui/console_routes.go | 1 + quesma/quesma/ui/html_pages.go | 5 ++--- quesma/quesma/ui/html_panels.go | 15 +++++++-------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/quesma/quesma/ui/asset/head.html b/quesma/quesma/ui/asset/head.html index 20dbfc73a..2237112e5 100644 --- a/quesma/quesma/ui/asset/head.html +++ b/quesma/quesma/ui/asset/head.html @@ -301,7 +301,7 @@ width: 100%; } - #dashboard-main svg { + #dashboard-main #svg-container { z-index: -1; position: absolute; width: 60%; @@ -327,9 +327,10 @@ } } - #dashboard-main svg text { + #dashboard-main .traffic-element { padding: 5px; - font-size: 1.5em; + font-size: 1.3vw; + position: absolute; } #dashboard-main .red { diff --git a/quesma/quesma/ui/console_routes.go b/quesma/quesma/ui/console_routes.go index 30ba8444f..13329271b 100644 --- a/quesma/quesma/ui/console_routes.go +++ b/quesma/quesma/ui/console_routes.go @@ -103,6 +103,7 @@ func (qmc *QuesmaManagementConsole) createRouting() *mux.Router { router.HandleFunc("/panel/dashboard", func(writer http.ResponseWriter, req *http.Request) { buf := qmc.generateDashboardPanel() + buf = append(buf, qmc.generateDashboardTrafficPanel()...) _, _ = writer.Write(buf) }) diff --git a/quesma/quesma/ui/html_pages.go b/quesma/quesma/ui/html_pages.go index 3c462d6df..b93144555 100644 --- a/quesma/quesma/ui/html_pages.go +++ b/quesma/quesma/ui/html_pages.go @@ -599,6 +599,7 @@ func (qmc *QuesmaManagementConsole) generateDashboard() []byte { buffer.Html(`});`) buffer.Html(`` + "\n") + buffer.Html(`
`) buffer.Html(`` + "\n") // One limitation is that, we don't update color of paths after initial draw. // They rarely change, so it's not a big deal for now. @@ -624,10 +625,8 @@ func (qmc *QuesmaManagementConsole) generateDashboard() []byte { buffer.Html(fmt.Sprintf(``, status)) } buffer.Html(`` + "\n") - - buffer.Html(`
`) buffer.Write(qmc.generateDashboardTrafficPanel()) - buffer.Html(`
`) + buffer.Html(`
` + "\n") buffer.Html(`
` + "\n") buffer.Write(qmc.generateDashboardPanel()) diff --git a/quesma/quesma/ui/html_panels.go b/quesma/quesma/ui/html_panels.go index dd71c4f0a..0e7547f12 100644 --- a/quesma/quesma/ui/html_panels.go +++ b/quesma/quesma/ui/html_panels.go @@ -328,34 +328,33 @@ func (qmc *QuesmaManagementConsole) generateDashboardTrafficText(typeName string func (qmc *QuesmaManagementConsole) generateDashboardTrafficElement(typeName string, y int) string { status, text := qmc.generateDashboardTrafficText(typeName) - return fmt.Sprintf(`%s`, y, status, text) + return fmt.Sprintf( + `
%s
`, + y, typeName, status, text) } func (qmc *QuesmaManagementConsole) generateDashboardTrafficPanel() []byte { var buffer HtmlBuffer - buffer.Html(``) - // Clickhouse -> Kibana if qmc.config.ReadsFromClickhouse() { - buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticKibana2Clickhouse, 240)) + buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticKibana2Clickhouse, 21)) } // Elasticsearch -> Kibana if qmc.config.ReadsFromElasticsearch() { - buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticKibana2Elasticsearch, 690)) + buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticKibana2Elasticsearch, 66)) } // Ingest -> Clickhouse if qmc.config.WritesToClickhouse() { - buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticIngest2Clickhouse, 340)) + buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticIngest2Clickhouse, 31)) } // Ingest -> Elasticsearch if qmc.config.WritesToElasticsearch() { - buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticIngest2Elasticsearch, 790)) + buffer.Html(qmc.generateDashboardTrafficElement(RequestStatisticIngest2Elasticsearch, 76)) } - buffer.Html(``) return buffer.Bytes() } From c8175a56f92cdb0c6545548fe126be0a09630ffd Mon Sep 17 00:00:00 2001 From: Jacek Migdal Date: Fri, 3 May 2024 19:25:09 +0200 Subject: [PATCH 4/6] Minor fix --- quesma/quesma/ui/asset/head.html | 1 - quesma/quesma/ui/console_routes.go | 5 ----- 2 files changed, 6 deletions(-) diff --git a/quesma/quesma/ui/asset/head.html b/quesma/quesma/ui/asset/head.html index 2237112e5..31f6103fb 100644 --- a/quesma/quesma/ui/asset/head.html +++ b/quesma/quesma/ui/asset/head.html @@ -328,7 +328,6 @@ } #dashboard-main .traffic-element { - padding: 5px; font-size: 1.3vw; position: absolute; } diff --git a/quesma/quesma/ui/console_routes.go b/quesma/quesma/ui/console_routes.go index 13329271b..c29652fe5 100644 --- a/quesma/quesma/ui/console_routes.go +++ b/quesma/quesma/ui/console_routes.go @@ -107,11 +107,6 @@ func (qmc *QuesmaManagementConsole) createRouting() *mux.Router { _, _ = writer.Write(buf) }) - router.HandleFunc("/panel/dashboard-traffic", func(writer http.ResponseWriter, req *http.Request) { - buf := qmc.generateDashboardTrafficPanel() - _, _ = writer.Write(buf) - }) - router.PathPrefix("/request-Id/{requestId}").HandlerFunc(func(writer http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) buf := qmc.generateReportForRequestId(vars["requestId"]) From 3ce7c1b137f4e2c128720cec9dd66488ee77829f Mon Sep 17 00:00:00 2001 From: Jacek Migdal Date: Fri, 3 May 2024 19:36:46 +0200 Subject: [PATCH 5/6] Show right tools --- quesma/quesma/ui/html_panels.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/quesma/quesma/ui/html_panels.go b/quesma/quesma/ui/html_panels.go index 0e7547f12..5a1379ea5 100644 --- a/quesma/quesma/ui/html_panels.go +++ b/quesma/quesma/ui/html_panels.go @@ -239,8 +239,15 @@ func statusToDiv(s healthCheckStatus) string { func (qmc *QuesmaManagementConsole) generateDashboardPanel() []byte { var buffer HtmlBuffer + dashboardName := "

Kibana

" + storeName := "

Elasticsearch

" + if qmc.config.Elasticsearch.Url != nil && strings.Contains(qmc.config.Elasticsearch.Url.String(), "opensearch") { + dashboardName = "

OpenSearch

Dashboards

" + storeName = "

OpenSearch

" + } + buffer.Html(`
`) - buffer.Html(`

Kibana

`) + buffer.Html(dashboardName) buffer.Html(statusToDiv(qmc.checkKibana())) buffer.Html(`
`) @@ -250,7 +257,7 @@ func (qmc *QuesmaManagementConsole) generateDashboardPanel() []byte { buffer.Html(`
`) buffer.Html(`
`) - buffer.Html(`

Elastic

search

`) + buffer.Html(storeName) buffer.Html(statusToDiv(qmc.checkElasticsearch())) buffer.Html(`
`) From ebfe534c7459665d5a60d08f0b2f0293c3f1e6a8 Mon Sep 17 00:00:00 2001 From: Jacek Migdal Date: Fri, 3 May 2024 20:08:30 +0200 Subject: [PATCH 6/6] Add admin links --- docker/local-dev.yml | 1 - docker/opensearch.yml | 1 - docker/quesma/config/local-dev.yaml | 8 +++++--- quesma/quesma/config/config.go | 2 ++ quesma/quesma/ui/html_panels.go | 19 ++++++++++++++++++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docker/local-dev.yml b/docker/local-dev.yml index 1f04fa129..51f77bad9 100644 --- a/docker/local-dev.yml +++ b/docker/local-dev.yml @@ -11,7 +11,6 @@ services: - QUESMA_elasticsearch_url=http://elasticsearch:9200 - QUESMA_port=8080 - QUESMA_logging_path=/var/quesma/logs - - QUESMA_clickhouse_url=clickhouse://clickhouse:9000 - QUESMA_mode=dual-write-query-clickhouse - QUESMA_CONFIG_FILE=/config/local-dev.yaml depends_on: diff --git a/docker/opensearch.yml b/docker/opensearch.yml index 791962d06..09ff9b8af 100644 --- a/docker/opensearch.yml +++ b/docker/opensearch.yml @@ -11,7 +11,6 @@ services: - QUESMA_elasticsearch_url=http://opensearch:9200 - QUESMA_port=8080 - QUESMA_logging_path=/var/quesma/logs - - QUESMA_clickhouse_url=clickhouse://clickhouse:9000 - QUESMA_CONFIG_FILE=/config/local-dev.yaml depends_on: clickhouse: diff --git a/docker/quesma/config/local-dev.yaml b/docker/quesma/config/local-dev.yaml index f1e39b071..e9e7b4cf0 100644 --- a/docker/quesma/config/local-dev.yaml +++ b/docker/quesma/config/local-dev.yaml @@ -2,10 +2,12 @@ mode: "dual-write-query-clickhouse" port: 8080 # public tcp port to listen for incoming traffic elasticsearch: - url: "http://localhost:9200" + #url: "http://localhost:9200" call: false -#clickhouse: # this config is going to be removed, but for now let's just comment out -# url: "clickhouse://localhost:9000" + adminUrl: "http://localhost:5601" +clickhouse: + url: "clickhouse://clickhouse:9000" + adminUrl: "http://localhost:8123/play" ingestStatistics: true internalTelemetryUrl: "https://api.quesma.com/phone-home" logging: diff --git a/quesma/quesma/config/config.go b/quesma/quesma/config/config.go index ff4235bb4..0b5536f7a 100644 --- a/quesma/quesma/config/config.go +++ b/quesma/quesma/config/config.go @@ -55,6 +55,7 @@ type ElasticsearchConfiguration struct { User string `koanf:"user"` Password string `koanf:"password"` Call bool `koanf:"call"` + AdminUrl *Url `koanf:"adminUrl"` } type RelationalDbConfiguration struct { @@ -62,6 +63,7 @@ type RelationalDbConfiguration struct { User string `koanf:"user"` Password string `koanf:"password"` Database string `koanf:"database"` + AdminUrl *Url `koanf:"adminUrl"` } func (c *RelationalDbConfiguration) IsEmpty() bool { diff --git a/quesma/quesma/ui/html_panels.go b/quesma/quesma/ui/html_panels.go index 5a1379ea5..ba8f1ee65 100644 --- a/quesma/quesma/ui/html_panels.go +++ b/quesma/quesma/ui/html_panels.go @@ -246,8 +246,19 @@ func (qmc *QuesmaManagementConsole) generateDashboardPanel() []byte { storeName = "

OpenSearch

" } + clickhouseName := "

ClickHouse

" + if qmc.config.Hydrolix.Url != nil { + clickhouseName = "

Hydrolix

" + } + buffer.Html(`
`) + if qmc.config.Elasticsearch.AdminUrl != nil { + buffer.Html(fmt.Sprintf(``, qmc.config.Elasticsearch.AdminUrl.String())) + } buffer.Html(dashboardName) + if qmc.config.Elasticsearch.AdminUrl != nil { + buffer.Html(``) + } buffer.Html(statusToDiv(qmc.checkKibana())) buffer.Html(`
`) @@ -262,7 +273,13 @@ func (qmc *QuesmaManagementConsole) generateDashboardPanel() []byte { buffer.Html(``) buffer.Html(`
`) - buffer.Html(`

ClickHouse

`) + if qmc.config.ClickHouse.AdminUrl != nil { + buffer.Html(fmt.Sprintf(``, qmc.config.ClickHouse.AdminUrl.String())) + } + buffer.Html(clickhouseName) + if qmc.config.ClickHouse.AdminUrl != nil { + buffer.Html(``) + } buffer.Html(statusToDiv(qmc.checkClickhouseHealth())) buffer.Html(`
`)