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
No related branches found
No related tags found
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 @@
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 1,
"id": 2,
"links": [
{
"asDropdown": false,
......@@ -53,10 +52,12 @@
"type": "prometheus",
"uid": "P18F45E9DC7E75912"
},
"description": "Quality of Service",
"fieldConfig": {
"defaults": {
"displayName": "QoS",
"mappings": [],
"max": 100,
"min": 0,
"thresholds": {
"mode": "absolute",
"steps": [
......@@ -110,7 +111,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "",
"pluginVersion": "10.4.9",
"targets": [
{
"datasource": {
......@@ -129,6 +130,7 @@
"useBackend": false
}
],
"title": "QoS",
"type": "stat"
},
{
......@@ -139,90 +141,6 @@
},
"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 +158,7 @@
"gridPos": {
"h": 3,
"w": 4,
"x": 8,
"x": 4,
"y": 1
},
"id": 4,
......@@ -261,7 +179,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "",
"pluginVersion": "10.4.9",
"targets": [
{
"datasource": {
......@@ -280,6 +198,7 @@
"useBackend": false
}
],
"title": "Databases",
"type": "stat"
},
{
......@@ -290,7 +209,6 @@
},
"fieldConfig": {
"defaults": {
"displayName": "Datasources",
"mappings": [],
"thresholds": {
"mode": "absolute",
......@@ -308,7 +226,7 @@
"gridPos": {
"h": 3,
"w": 4,
"x": 12,
"x": 8,
"y": 1
},
"id": 5,
......@@ -329,7 +247,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "",
"pluginVersion": "10.4.9",
"targets": [
{
"datasource": {
......@@ -382,6 +300,7 @@
"useBackend": false
}
],
"title": "Datasources",
"transformations": [
{
"id": "calculateField",
......@@ -405,7 +324,6 @@
},
"fieldConfig": {
"defaults": {
"displayName": "Volume",
"mappings": [],
"thresholds": {
"mode": "absolute",
......@@ -423,7 +341,7 @@
"gridPos": {
"h": 3,
"w": 4,
"x": 16,
"x": 12,
"y": 1
},
"id": 8,
......@@ -444,7 +362,7 @@
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "",
"pluginVersion": "10.4.9",
"targets": [
{
"datasource": {
......@@ -463,6 +381,7 @@
"useBackend": false
}
],
"title": "Data Volume",
"type": "stat"
},
{
......@@ -478,94 +397,6 @@
"title": "Services",
"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": {
"default": true,
......@@ -766,7 +597,7 @@
"h": 6,
"w": 24,
"x": 0,
"y": 14
"y": 5
},
"id": 1,
"options": {
......@@ -929,7 +760,7 @@
"h": 6,
"w": 24,
"x": 0,
"y": 20
"y": 11
},
"id": 6,
"options": {
......@@ -1090,7 +921,7 @@
"h": 6,
"w": 24,
"x": 0,
"y": 26
"y": 17
},
"id": 7,
"options": {
......
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);
......
......@@ -16,4 +16,4 @@ scrape_configs:
- 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']
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=""
......@@ -42,4 +42,4 @@ ENV NUXT_PUBLIC_COMMIT="${COMMIT:-}"
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({
modules: [
'@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt',
'@nuxtjs/i18n',
'@artmizu/nuxt-prometheus'
'@nuxtjs/i18n'
],
pinia: {
......
......@@ -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",
......
......@@ -8,6 +8,7 @@ volumes:
storage-service-data:
identity-service-data:
metric-db-data:
dashboard-service-data:
services:
dbrepo-metadata-db:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment