refactor(backend): standardize errors and simplify configuration and test setup

This commit is contained in:
TakuyaYagam1 committed 2026-10-05 16:15:30 +03:00
1 parent 1535c19b8c
commit 138666a7bb
92 files changed
+3994 -210

No files matched your search

+1 -1
View File
@@ -13,7 +13,7 @@ discovery.relabel "application" {
rule {
source_labels = ["__meta_docker_container_label_com_docker_compose_service"]
regex = "backend|frontend|postgres"
regex = "backend|frontend|postgres|redis|seaweedfs"
action = "keep"
}
+333
View File
@@ -0,0 +1,333 @@
{
"annotations": {
"list": []
},
"editable": false,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "up{job=\"redis\"}",
"legendFormat": "exporter",
"refId": "A"
},
{
"editorMode": "code",
"expr": "redis_up{job=\"redis\"}",
"legendFormat": "Redis",
"refId": "B"
}
],
"title": "Availability",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 2,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "redis_memory_used_bytes{job=\"redis\"}",
"legendFormat": "used",
"refId": "A"
},
{
"editorMode": "code",
"expr": "redis_memory_max_bytes{job=\"redis\"}",
"legendFormat": "limit",
"refId": "B"
}
],
"title": "Memory",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 3,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "rate(redis_keyspace_hits_total{job=\"redis\"}[5m])",
"legendFormat": "hits",
"refId": "A"
},
{
"editorMode": "code",
"expr": "rate(redis_keyspace_misses_total{job=\"redis\"}[5m])",
"legendFormat": "misses",
"refId": "B"
}
],
"title": "Cache lookups per second",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 8
},
"id": 4,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "rate(redis_expired_keys_total{job=\"redis\"}[5m])",
"legendFormat": "expired",
"refId": "A"
},
{
"editorMode": "code",
"expr": "rate(redis_evicted_keys_total{job=\"redis\"}[5m])",
"legendFormat": "evicted",
"refId": "B"
}
],
"title": "Expired and evicted keys per second",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 16
},
"id": 5,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "redis_connected_clients{job=\"redis\"}",
"legendFormat": "clients",
"refId": "A"
}
],
"title": "Connected clients",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 16
},
"id": 6,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "rate(redis_commands_processed_total{job=\"redis\"}[5m])",
"legendFormat": "commands",
"refId": "A"
}
],
"title": "Commands per second",
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 41,
"tags": [
"redis",
"cache"
],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timezone": "browser",
"title": "Redis",
"uid": "redis",
"version": 1
}
@@ -0,0 +1,327 @@
{
"annotations": {
"list": []
},
"editable": false,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"panels": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 0
},
"id": 1,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "up{job=\"seaweedfs\"}",
"legendFormat": "metrics endpoint",
"refId": "A"
},
{
"editorMode": "code",
"expr": "SeaweedFS_master_is_leader{job=\"seaweedfs\"}",
"legendFormat": "master leader",
"refId": "B"
}
],
"title": "Availability",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "ops"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"id": 2,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "sum by (type, code) (rate(SeaweedFS_s3_request_total{job=\"seaweedfs\"}[5m]))",
"legendFormat": "{{type}} {{code}}",
"refId": "A"
}
],
"title": "S3 requests per second",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "s"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"id": 3,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "histogram_quantile(0.95, sum by (type, le) (rate(SeaweedFS_s3_request_seconds_bucket{job=\"seaweedfs\"}[5m])))",
"legendFormat": "{{type}}",
"refId": "A"
}
],
"title": "S3 request duration p95",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 8
},
"id": 4,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "SeaweedFS_volumeServer_resource{job=\"seaweedfs\"}",
"legendFormat": "{{name}} {{type}}",
"refId": "A"
}
],
"title": "Storage filesystem",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "bytes"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 16
},
"id": 5,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "process_resident_memory_bytes{job=\"seaweedfs\"}",
"legendFormat": "resident",
"refId": "A"
}
],
"title": "Process memory",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"drawStyle": "line",
"fillOpacity": 10,
"lineWidth": 1,
"showPoints": "never"
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 16
},
"id": 6,
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
},
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"editorMode": "code",
"expr": "SeaweedFS_volumeServer_file_write_failures{job=\"seaweedfs\"}",
"legendFormat": "write failures",
"refId": "A"
},
{
"editorMode": "code",
"expr": "SeaweedFS_volumeServer_file_read_failures{job=\"seaweedfs\"}",
"legendFormat": "read failures",
"refId": "B"
},
{
"editorMode": "code",
"expr": "SeaweedFS_volumeServer_disk_error_status{job=\"seaweedfs\"}",
"legendFormat": "{{name}} disk error",
"refId": "C"
}
],
"title": "Storage errors",
"type": "timeseries"
}
],
"refresh": "30s",
"schemaVersion": 41,
"tags": [
"seaweedfs",
"storage"
],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timezone": "browser",
"title": "SeaweedFS",
"uid": "seaweedfs",
"version": 1
}
+14
View File
@@ -19,6 +19,20 @@ scrape_configs:
- targets:
- postgres-exporter:9187
- job_name: redis
static_configs:
- targets:
- redis-exporter:9121
- job_name: seaweedfs
static_configs:
- targets:
- seaweedfs:9327
metric_relabel_configs:
- source_labels: [__name__]
action: keep
regex: 'SeaweedFS_(build_info|master_is_leader|s3_request_total|s3_request_seconds_(bucket|sum|count)|volumeServer_(resource|file_write_failures|file_read_failures|disk_error_status))|process_(resident_memory_bytes|cpu_seconds_total)'
- job_name: node
static_configs:
- targets: