diff --git a/dbrepo-dashboard-service/dashboards/system.json b/dbrepo-dashboard-service/dashboards/system.json index 68279f8fe4ffc11a52e7a53de0d21f07797f80d5..4d5d4e4b00293cf89dece1058f82e7d7292472cb 100644 --- a/dbrepo-dashboard-service/dashboards/system.json +++ b/dbrepo-dashboard-service/dashboards/system.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 1, - "id": 2, + "id": 3, "links": [ { "asDropdown": false, @@ -55,174 +55,6 @@ }, "fieldConfig": { "defaults": { - "displayName": "QoS", - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "purple", - "value": null - }, - { - "color": "red", - "value": 0 - }, - { - "color": "orange", - "value": 60 - }, - { - "color": "#EAB839", - "value": 80 - }, - { - "color": "green", - "value": 100 - } - ] - }, - "unit": "percent" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 4, - "x": 0, - "y": 1 - }, - "id": 9, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P18F45E9DC7E75912" - }, - "disableTextWrap": false, - "editorMode": "code", - "expr": "sum(up)*100/count(up)", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Services Running", - "range": true, - "refId": "A", - "useBackend": false - } - ], - "type": "stat" - }, - { - "datasource": { - "default": true, - "type": "prometheus", - "uid": "P18F45E9DC7E75912" - }, - "fieldConfig": { - "defaults": { - "displayName": "UI Response Time (Mean)", - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "purple", - "value": null - }, - { - "color": "green", - "value": 0 - }, - { - "color": "yellow", - "value": 200 - }, - { - "color": "orange", - "value": 400 - }, - { - "color": "red", - "value": 600 - } - ] - }, - "unit": "ms" - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 4, - "x": 4, - "y": 1 - }, - "id": 17, - "options": { - "colorMode": "background", - "graphMode": "none", - "justifyMode": "auto", - "orientation": "auto", - "percentChangeColorMode": "standard", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "showPercentChange": false, - "textMode": "auto", - "wideLayout": true - }, - "pluginVersion": "", - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "P18F45E9DC7E75912" - }, - "editorMode": "code", - "expr": "avg(page_total_time)", - "format": "table", - "intervalFactor": 3, - "legendFormat": "__auto", - "range": true, - "refId": "B", - "step": 15, - "target": "dev.grafana.cb-office.alerting.active_alerts" - } - ], - "type": "stat" - }, - { - "datasource": { - "default": true, - "type": "prometheus", - "uid": "P18F45E9DC7E75912" - }, - "fieldConfig": { - "defaults": { - "displayName": "Databases", "mappings": [], "thresholds": { "mode": "absolute", @@ -240,7 +72,7 @@ "gridPos": { "h": 3, "w": 4, - "x": 8, + "x": 0, "y": 1 }, "id": 4, @@ -261,7 +93,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "", + "pluginVersion": "10.4.9", "targets": [ { "datasource": { @@ -280,6 +112,7 @@ "useBackend": false } ], + "title": "Databases", "type": "stat" }, { @@ -290,7 +123,6 @@ }, "fieldConfig": { "defaults": { - "displayName": "Datasources", "mappings": [], "thresholds": { "mode": "absolute", @@ -308,7 +140,7 @@ "gridPos": { "h": 3, "w": 4, - "x": 12, + "x": 4, "y": 1 }, "id": 5, @@ -329,7 +161,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "", + "pluginVersion": "10.4.9", "targets": [ { "datasource": { @@ -382,6 +214,7 @@ "useBackend": false } ], + "title": "Datasources", "transformations": [ { "id": "calculateField", @@ -403,9 +236,9 @@ "type": "prometheus", "uid": "P18F45E9DC7E75912" }, + "description": "", "fieldConfig": { "defaults": { - "displayName": "Volume", "mappings": [], "thresholds": { "mode": "absolute", @@ -423,7 +256,7 @@ "gridPos": { "h": 3, "w": 4, - "x": 16, + "x": 8, "y": 1 }, "id": 8, @@ -444,7 +277,7 @@ "textMode": "auto", "wideLayout": true }, - "pluginVersion": "", + "pluginVersion": "10.4.9", "targets": [ { "datasource": { @@ -463,6 +296,7 @@ "useBackend": false } ], + "title": "Data Volume", "type": "stat" }, { @@ -480,66 +314,70 @@ }, { "datasource": { + "default": true, "type": "prometheus", "uid": "P18F45E9DC7E75912" }, + "description": "Quality of Service", "fieldConfig": { "defaults": { - "color": { - "mode": "thresholds" - }, "mappings": [], + "max": 100, + "min": 0, "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", + "color": "purple", "value": null }, { - "color": "#EAB839", - "value": 200 + "color": "red", + "value": 0 }, { "color": "orange", - "value": 400 + "value": 60 }, { - "color": "red", - "value": 600 + "color": "#EAB839", + "value": 80 + }, + { + "color": "green", + "value": 100 } ] }, - "unit": "ms" + "unit": "percent" }, "overrides": [] }, "gridPos": { - "h": 9, - "w": 24, + "h": 4, + "w": 4, "x": 0, "y": 5 }, - "id": 13, + "id": 9, "options": { - "displayMode": "gradient", - "maxVizHeight": 300, - "minVizHeight": 16, - "minVizWidth": 8, - "namePlacement": "auto", - "orientation": "horizontal", + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", "reduceOptions": { "calcs": [ - "mean" + "lastNotNull" ], "fields": "", "values": false }, - "showUnfilled": true, - "sizing": "auto", - "valueMode": "color" + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true }, - "pluginVersion": "", + "pluginVersion": "10.4.9", "targets": [ { "datasource": { @@ -547,241 +385,91 @@ "uid": "P18F45E9DC7E75912" }, "disableTextWrap": false, - "editorMode": "builder", - "exemplar": false, - "expr": "page_total_time{path!=\"empty: empty\"}", - "format": "time_series", + "editorMode": "code", + "expr": "sum(up)*100/count(up)", "fullMetaSearch": false, "includeNullMetadata": true, "instant": false, - "intervalFactor": 3, - "legendFormat": "{{path}}", + "legendFormat": "Services Running", "range": true, - "refId": "B", - "step": 15, - "target": "dev.grafana.cb-office.alerting.active_alerts", + "refId": "A", "useBackend": false } ], - "title": "UI Response Time", - "type": "bargauge" + "title": "QoS", + "type": "stat" }, { "datasource": { - "default": true, "type": "prometheus", "uid": "P18F45E9DC7E75912" }, "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "thresholds" }, "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 25, - "gradientMode": "none", + "fillOpacity": 70, "hideFrom": { "legend": false, "tooltip": false, "viz": false }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "normal" - }, - "thresholdsStyle": { - "mode": "off" + "lineWidth": 1 + }, + "mappings": [ + { + "options": { + "0": { + "index": 0, + "text": "DOWN" + }, + "1": { + "index": 1, + "text": "UP" + } + }, + "type": "value" } - }, - "mappings": [], + ], "thresholds": { "mode": "absolute", "steps": [ { - "color": "green", + "color": "red", "value": null }, { - "color": "red", - "value": 80 + "color": "green", + "value": 1 } ] } }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "auth-service:8080" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "yellow", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "broker-service:15692" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "light-blue", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "metadata-service:8080" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "analyse-service:80" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "super-light-red", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "auth-service-metrics:8080" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "green", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "metadata-service:80" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "blue", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "data-service:80" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "search-service:80" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "semi-dark-purple", - "mode": "fixed" - } - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "ui:80" - }, - "properties": [ - { - "id": "color", - "value": { - "fixedColor": "super-light-purple", - "mode": "fixed" - } - } - ] - } - ] + "overrides": [] }, "gridPos": { - "h": 6, - "w": 24, - "x": 0, - "y": 14 + "h": 8, + "w": 20, + "x": 4, + "y": 5 }, - "id": 1, + "id": 16, "options": { + "colWidth": 0.9, "legend": { - "calcs": [], "displayMode": "list", "placement": "bottom", - "showLegend": true + "showLegend": false }, + "rowHeight": 0.9, + "showValue": "auto", "tooltip": { "mode": "single", "sort": "none" } }, - "pluginVersion": "11.2.0", "targets": [ { "datasource": { @@ -792,7 +480,6 @@ "editorMode": "builder", "expr": "up", "fullMetaSearch": false, - "hide": false, "includeNullMetadata": true, "instant": false, "legendFormat": "{{instance}}", @@ -801,12 +488,81 @@ "useBackend": false } ], - "title": "Service Instances Running", - "type": "timeseries" + "title": "Service QoS", + "type": "status-history" + }, + { + "datasource": { + "type": "prometheus", + "uid": "P18F45E9DC7E75912" + }, + "description": "Total used disk space in Storage Service", + "fieldConfig": { + "defaults": { + "mappings": [], + "max": 100, + "min": 0, + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + }, + "unit": "decbytes" + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 4, + "x": 0, + "y": 9 + }, + "id": 17, + "options": { + "colorMode": "background", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "percentChangeColorMode": "standard", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "showPercentChange": false, + "textMode": "auto", + "wideLayout": true + }, + "pluginVersion": "10.4.9", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "P18F45E9DC7E75912" + }, + "disableTextWrap": false, + "editorMode": "code", + "expr": "SeaweedFS_volumeServer_total_disk_size", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A", + "useBackend": false + } + ], + "title": "S3 Volume", + "type": "stat" }, { "datasource": { - "default": true, "type": "prometheus", "uid": "P18F45E9DC7E75912" }, @@ -860,7 +616,8 @@ "value": 80 } ] - } + }, + "unit": "none" }, "overrides": [ { @@ -926,10 +683,10 @@ ] }, "gridPos": { - "h": 6, - "w": 24, + "h": 7, + "w": 12, "x": 0, - "y": 20 + "y": 13 }, "id": 6, "options": { @@ -960,7 +717,7 @@ "instant": false, "legendFormat": "{{instance}}", "range": true, - "refId": "Java", + "refId": "process_cpu_usage", "useBackend": false } ], @@ -1087,10 +844,10 @@ ] }, "gridPos": { - "h": 6, - "w": 24, - "x": 0, - "y": 26 + "h": 7, + "w": 12, + "x": 12, + "y": 13 }, "id": 7, "options": { @@ -1101,7 +858,7 @@ "showLegend": true }, "tooltip": { - "mode": "single", + "mode": "multi", "sort": "none" } }, @@ -1146,6 +903,6 @@ "timezone": "browser", "title": "DBRepo - Overview", "uid": "bdz20owu8zn5se", - "version": 1, + "version": 20, "weekStart": "" } \ No newline at end of file diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/MetricsConfig.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/MetricsConfig.java index e366666244515dca7965663ef5ce5016a734dd4a..1b7578b4bcdb547eae2cc26690ef028c38367787 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/MetricsConfig.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/config/MetricsConfig.java @@ -1,12 +1,10 @@ package at.tuwien.config; -import at.tuwien.entities.database.Database; import at.tuwien.entities.database.table.Table; import at.tuwien.repository.DatabaseRepository; import at.tuwien.repository.IdentifierRepository; import at.tuwien.repository.TableRepository; import at.tuwien.repository.ViewRepository; -import at.tuwien.service.DatabaseService; import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.Metrics; import io.micrometer.observation.ObservationRegistry; @@ -16,8 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import java.util.List; - @Log4j2 @Configuration public class MetricsConfig { @@ -70,7 +66,12 @@ public class MetricsConfig { @Bean public Gauge volumeSumGauge() { - return Gauge.builder("dbrepo.volume.sum", () -> tableRepository.findAll().stream().map(Table::getDataLength).mapToLong(d -> d).sum()) + return Gauge.builder("dbrepo.volume.sum", () -> { + if (tableRepository.findAll().isEmpty()) { + return 0; + } + return tableRepository.findAll().stream().map(Table::getDataLength).mapToLong(d -> d).sum(); + }) .description("The total volume of available research data") .strongReference(true) .register(Metrics.globalRegistry); diff --git a/dbrepo-metric-db/prometheus.yml b/dbrepo-metric-db/prometheus.yml index 447396d167785e7973855314431230fb1193bd0d..f7338b011371ec5b12757bbe14693248cc5c7bd3 100644 --- a/dbrepo-metric-db/prometheus.yml +++ b/dbrepo-metric-db/prometheus.yml @@ -9,11 +9,11 @@ alerting: - targets: [] scrape_configs: - - job_name: 'spring boot scrape' + - job_name: 'actuator scrape' metrics_path: '/actuator/prometheus' static_configs: - - targets: ['data-service:8080', 'metadata-service:8080'] + - targets: ['data-service:8080', 'metadata-service:8080', 'ui:3000'] - job_name: 'metrics scrape' metrics_path: '/metrics' static_configs: - - targets: ['auth-service:8080', 'analyse-service:8080', 'search-service:8080', 'data-db-sidecar:8080', 'broker-service:15692', 'ui:3000', 'dashboard-service:3000', 'storage-service:9090', 'upload-service:8080'] + - targets: ['auth-service:8080', 'analyse-service:8080', 'search-service:8080', 'data-db-sidecar:8080', 'broker-service:15692', 'dashboard-service:3000', 'storage-service:9090', 'upload-service:8080'] diff --git a/dbrepo-ui/Dockerfile b/dbrepo-ui/Dockerfile index 72a817ac8ab354004017e4007e000dac3fa95237..07f7f5d903e09c477753bdd0e52042cd61bcf6fb 100644 --- a/dbrepo-ui/Dockerfile +++ b/dbrepo-ui/Dockerfile @@ -1,10 +1,10 @@ -FROM node:18.20.4-alpine3.20 AS build +FROM oven/bun:1.1.20-alpine AS build WORKDIR /app COPY ./package.json ./package.json -RUN npm install +RUN bun install ENV NODE_ENV="production" @@ -22,9 +22,9 @@ COPY ./stores ./stores COPY ./utils ./utils COPY ./nuxt.config.ts ./nuxt.config.ts -RUN npm run build +RUN bun run build -FROM node:18.20.4-alpine3.20 AS runtime +FROM oven/bun:1.1.20-alpine AS runtime ARG APP_VERSION="latest" ARG COMMIT="" @@ -43,4 +43,4 @@ ENV NODE_OPTIONS="--max_old_space_size=4096" EXPOSE 3000 -ENTRYPOINT [ "node", ".output/server/index.mjs" ] +ENTRYPOINT [ "bun", "run", ".output/server/index.mjs" ] diff --git a/dbrepo-ui/bun.lockb b/dbrepo-ui/bun.lockb index 08343a9606e23719aa606a7bb102499777d9e001..d4a0ef58602cbb7a069d13bc894340f4b0d72465 100755 Binary files a/dbrepo-ui/bun.lockb and b/dbrepo-ui/bun.lockb differ diff --git a/dbrepo-ui/nuxt.config.ts b/dbrepo-ui/nuxt.config.ts index f33c990a71ca2ca1b4e594a6b219b8ac5cbcb748..bb30b673f456452b4e1360402b3783bfb27c6ffa 100644 --- a/dbrepo-ui/nuxt.config.ts +++ b/dbrepo-ui/nuxt.config.ts @@ -103,12 +103,16 @@ export default defineNuxtConfig({ }, links: { rabbitmq: { - text: 'RabbitMQ Admin', + text: 'Broker Service', href: '/admin/broker/' }, keycloak: { - text: 'Keycloak Admin', + text: 'Auth Service', href: '/api/auth/' + }, + grafana: { + text: 'Dashboard Service', + href: '/dashboard/' } } } @@ -123,8 +127,7 @@ export default defineNuxtConfig({ modules: [ '@pinia/nuxt', '@pinia-plugin-persistedstate/nuxt', - '@nuxtjs/i18n', - '@artmizu/nuxt-prometheus' + '@nuxtjs/i18n' ], pinia: { diff --git a/dbrepo-ui/package.json b/dbrepo-ui/package.json index a1ed44b93a9887fbe98bfd878ea5dd9aaf628262..2bbe6696bc2e59845e4d1d30194a860923f2760d 100644 --- a/dbrepo-ui/package.json +++ b/dbrepo-ui/package.json @@ -11,7 +11,6 @@ "prod": "bun run .output/server/index.mjs" }, "dependencies": { - "@artmizu/nuxt-prometheus": "^2.4.0", "@fontsource/open-sans": "^5.0.24", "@mdi/font": "^7.4.47", "@nuxtjs/robots": "^3.0.0", diff --git a/dbrepo-ui/server/routes/actuator/prometheus.ts b/dbrepo-ui/server/routes/actuator/prometheus.ts new file mode 100644 index 0000000000000000000000000000000000000000..3647103148b19761fe534d9a70ad004bd8e70199 --- /dev/null +++ b/dbrepo-ui/server/routes/actuator/prometheus.ts @@ -0,0 +1,4 @@ +export default defineEventHandler((event) => { + event.node.res.setHeader('Content-Type', 'text/plain'); + return 'service_started 1' +})