Skip to content
Snippets Groups Projects
Verified Commit 287bb0da authored by Martin Weise's avatar Martin Weise
Browse files

Fix UI prometheus bug memory leak

parent 3c427e1b
Branches
Tags
7 merge requests!345Updated docs and endpoints:,!341Fixed mapping problem where UK and FK share columns they are inserted,!339Fixed mapping problem where UK and FK share columns they are inserted,!338Fixed mapping problem where UK and FK share columns they are inserted,!334Fixed mapping problem where UK and FK share columns they are inserted,!333Fixed mapping problem where UK and FK share columns they are inserted,!328Hotfix/mapping
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
"editable": true, "editable": true,
"fiscalYearStartMonth": 0, "fiscalYearStartMonth": 0,
"graphTooltip": 1, "graphTooltip": 1,
"id": 2,
"links": [ "links": [
{ {
"asDropdown": false, "asDropdown": false,
...@@ -53,10 +52,12 @@ ...@@ -53,10 +52,12 @@
"type": "prometheus", "type": "prometheus",
"uid": "P18F45E9DC7E75912" "uid": "P18F45E9DC7E75912"
}, },
"description": "Quality of Service",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"displayName": "QoS",
"mappings": [], "mappings": [],
"max": 100,
"min": 0,
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
"steps": [ "steps": [
...@@ -110,7 +111,7 @@ ...@@ -110,7 +111,7 @@
"textMode": "auto", "textMode": "auto",
"wideLayout": true "wideLayout": true
}, },
"pluginVersion": "", "pluginVersion": "10.4.9",
"targets": [ "targets": [
{ {
"datasource": { "datasource": {
...@@ -129,6 +130,7 @@ ...@@ -129,6 +130,7 @@
"useBackend": false "useBackend": false
} }
], ],
"title": "QoS",
"type": "stat" "type": "stat"
}, },
{ {
...@@ -139,90 +141,6 @@ ...@@ -139,90 +141,6 @@
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "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": [], "mappings": [],
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
...@@ -240,7 +158,7 @@ ...@@ -240,7 +158,7 @@
"gridPos": { "gridPos": {
"h": 3, "h": 3,
"w": 4, "w": 4,
"x": 8, "x": 4,
"y": 1 "y": 1
}, },
"id": 4, "id": 4,
...@@ -261,7 +179,7 @@ ...@@ -261,7 +179,7 @@
"textMode": "auto", "textMode": "auto",
"wideLayout": true "wideLayout": true
}, },
"pluginVersion": "", "pluginVersion": "10.4.9",
"targets": [ "targets": [
{ {
"datasource": { "datasource": {
...@@ -280,6 +198,7 @@ ...@@ -280,6 +198,7 @@
"useBackend": false "useBackend": false
} }
], ],
"title": "Databases",
"type": "stat" "type": "stat"
}, },
{ {
...@@ -290,7 +209,6 @@ ...@@ -290,7 +209,6 @@
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"displayName": "Datasources",
"mappings": [], "mappings": [],
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
...@@ -308,7 +226,7 @@ ...@@ -308,7 +226,7 @@
"gridPos": { "gridPos": {
"h": 3, "h": 3,
"w": 4, "w": 4,
"x": 12, "x": 8,
"y": 1 "y": 1
}, },
"id": 5, "id": 5,
...@@ -329,7 +247,7 @@ ...@@ -329,7 +247,7 @@
"textMode": "auto", "textMode": "auto",
"wideLayout": true "wideLayout": true
}, },
"pluginVersion": "", "pluginVersion": "10.4.9",
"targets": [ "targets": [
{ {
"datasource": { "datasource": {
...@@ -382,6 +300,7 @@ ...@@ -382,6 +300,7 @@
"useBackend": false "useBackend": false
} }
], ],
"title": "Datasources",
"transformations": [ "transformations": [
{ {
"id": "calculateField", "id": "calculateField",
...@@ -405,7 +324,6 @@ ...@@ -405,7 +324,6 @@
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
"displayName": "Volume",
"mappings": [], "mappings": [],
"thresholds": { "thresholds": {
"mode": "absolute", "mode": "absolute",
...@@ -423,7 +341,7 @@ ...@@ -423,7 +341,7 @@
"gridPos": { "gridPos": {
"h": 3, "h": 3,
"w": 4, "w": 4,
"x": 16, "x": 12,
"y": 1 "y": 1
}, },
"id": 8, "id": 8,
...@@ -444,7 +362,7 @@ ...@@ -444,7 +362,7 @@
"textMode": "auto", "textMode": "auto",
"wideLayout": true "wideLayout": true
}, },
"pluginVersion": "", "pluginVersion": "10.4.9",
"targets": [ "targets": [
{ {
"datasource": { "datasource": {
...@@ -463,6 +381,7 @@ ...@@ -463,6 +381,7 @@
"useBackend": false "useBackend": false
} }
], ],
"title": "Data Volume",
"type": "stat" "type": "stat"
}, },
{ {
...@@ -478,94 +397,6 @@ ...@@ -478,94 +397,6 @@
"title": "Services", "title": "Services",
"type": "row" "type": "row"
}, },
{
"datasource": {
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "#EAB839",
"value": 200
},
{
"color": "orange",
"value": 400
},
{
"color": "red",
"value": 600
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 5
},
"id": 13,
"options": {
"displayMode": "gradient",
"maxVizHeight": 300,
"minVizHeight": 16,
"minVizWidth": 8,
"namePlacement": "auto",
"orientation": "horizontal",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"showUnfilled": true,
"sizing": "auto",
"valueMode": "color"
},
"pluginVersion": "",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"disableTextWrap": false,
"editorMode": "builder",
"exemplar": false,
"expr": "page_total_time{path!=\"empty: empty\"}",
"format": "time_series",
"fullMetaSearch": false,
"includeNullMetadata": true,
"instant": false,
"intervalFactor": 3,
"legendFormat": "{{path}}",
"range": true,
"refId": "B",
"step": 15,
"target": "dev.grafana.cb-office.alerting.active_alerts",
"useBackend": false
}
],
"title": "UI Response Time",
"type": "bargauge"
},
{ {
"datasource": { "datasource": {
"default": true, "default": true,
...@@ -766,7 +597,7 @@ ...@@ -766,7 +597,7 @@
"h": 6, "h": 6,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 14 "y": 5
}, },
"id": 1, "id": 1,
"options": { "options": {
...@@ -929,7 +760,7 @@ ...@@ -929,7 +760,7 @@
"h": 6, "h": 6,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 20 "y": 11
}, },
"id": 6, "id": 6,
"options": { "options": {
...@@ -1090,7 +921,7 @@ ...@@ -1090,7 +921,7 @@
"h": 6, "h": 6,
"w": 24, "w": 24,
"x": 0, "x": 0,
"y": 26 "y": 17
}, },
"id": 7, "id": 7,
"options": { "options": {
......
package at.tuwien.config; package at.tuwien.config;
import at.tuwien.entities.database.Database;
import at.tuwien.entities.database.table.Table; import at.tuwien.entities.database.table.Table;
import at.tuwien.repository.DatabaseRepository; import at.tuwien.repository.DatabaseRepository;
import at.tuwien.repository.IdentifierRepository; import at.tuwien.repository.IdentifierRepository;
import at.tuwien.repository.TableRepository; import at.tuwien.repository.TableRepository;
import at.tuwien.repository.ViewRepository; import at.tuwien.repository.ViewRepository;
import at.tuwien.service.DatabaseService;
import io.micrometer.core.instrument.Gauge; import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.Metrics; import io.micrometer.core.instrument.Metrics;
import io.micrometer.observation.ObservationRegistry; import io.micrometer.observation.ObservationRegistry;
...@@ -16,8 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -16,8 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.List;
@Log4j2 @Log4j2
@Configuration @Configuration
public class MetricsConfig { public class MetricsConfig {
...@@ -70,7 +66,12 @@ public class MetricsConfig { ...@@ -70,7 +66,12 @@ public class MetricsConfig {
@Bean @Bean
public Gauge volumeSumGauge() { 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") .description("The total volume of available research data")
.strongReference(true) .strongReference(true)
.register(Metrics.globalRegistry); .register(Metrics.globalRegistry);
......
...@@ -16,4 +16,4 @@ scrape_configs: ...@@ -16,4 +16,4 @@ scrape_configs:
- job_name: 'metrics scrape' - job_name: 'metrics scrape'
metrics_path: '/metrics' metrics_path: '/metrics'
static_configs: 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']
FROM node:18.20.4-alpine3.20 AS build FROM oven/bun:1.1.20-alpine AS build
WORKDIR /app WORKDIR /app
COPY ./package.json ./package.json COPY ./package.json ./package.json
RUN npm install RUN bun install
ENV NODE_ENV="production" ENV NODE_ENV="production"
...@@ -22,9 +22,9 @@ COPY ./stores ./stores ...@@ -22,9 +22,9 @@ COPY ./stores ./stores
COPY ./utils ./utils COPY ./utils ./utils
COPY ./nuxt.config.ts ./nuxt.config.ts 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 APP_VERSION="latest"
ARG COMMIT="" ARG COMMIT=""
...@@ -42,4 +42,4 @@ ENV NUXT_PUBLIC_COMMIT="${COMMIT:-}" ...@@ -42,4 +42,4 @@ ENV NUXT_PUBLIC_COMMIT="${COMMIT:-}"
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT [ "node", ".output/server/index.mjs" ] ENTRYPOINT [ "bun", "run", ".output/server/index.mjs" ]
No preview for this file type
...@@ -123,8 +123,7 @@ export default defineNuxtConfig({ ...@@ -123,8 +123,7 @@ export default defineNuxtConfig({
modules: [ modules: [
'@pinia/nuxt', '@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt', '@pinia-plugin-persistedstate/nuxt',
'@nuxtjs/i18n', '@nuxtjs/i18n'
'@artmizu/nuxt-prometheus'
], ],
pinia: { pinia: {
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
"prod": "bun run .output/server/index.mjs" "prod": "bun run .output/server/index.mjs"
}, },
"dependencies": { "dependencies": {
"@artmizu/nuxt-prometheus": "^2.4.0",
"@fontsource/open-sans": "^5.0.24", "@fontsource/open-sans": "^5.0.24",
"@mdi/font": "^7.4.47", "@mdi/font": "^7.4.47",
"@nuxtjs/robots": "^3.0.0", "@nuxtjs/robots": "^3.0.0",
......
...@@ -8,6 +8,7 @@ volumes: ...@@ -8,6 +8,7 @@ volumes:
storage-service-data: storage-service-data:
identity-service-data: identity-service-data:
metric-db-data: metric-db-data:
dashboard-service-data:
services: services:
dbrepo-metadata-db: dbrepo-metadata-db:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment