лаба на 3

This commit is contained in:
2026-11-23 21:17:22 +03:00
parent 470d9d6f1e
commit d5416a6cc2
52 changed files with 5197 additions and 0 deletions
+343
View File
@@ -0,0 +1,343 @@
{
"id": null,
"uid": "lab6-messenger",
"title": "Lab6 - Messenger Observability",
"tags": [
"lab6",
"messenger",
"opentelemetry"
],
"timezone": "browser",
"schemaVersion": 39,
"version": 1,
"editable": false,
"refresh": "10s",
"time": {
"from": "now-30m",
"to": "now"
},
"panels": [
{
"id": 1,
"title": "HTTP Request Rate",
"description": "HTTP requests per second by method and route",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (method, route) (rate(messenger_http_requests_total[$__rate_interval]))",
"legendFormat": "{{method}} {{route}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "reqps",
"min": 0,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "auto"
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
},
{
"id": 2,
"title": "HTTP Errors (5xx)",
"description": "Server errors per second",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_http_requests_total{status_code=~\"5..\"}[$__rate_interval])) or (0 * sum(rate(messenger_http_requests_total[$__rate_interval])))",
"legendFormat": "5xx errors",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "reqps",
"min": 0,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "auto"
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
},
{
"id": 3,
"title": "HTTP Request Duration",
"description": "Mean HTTP request duration",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(rate(messenger_http_request_duration_seconds_sum[$__rate_interval])) / sum(rate(messenger_http_request_duration_seconds_count[$__rate_interval]))",
"legendFormat": "Mean duration",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "auto"
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
},
{
"id": 4,
"title": "Successful Jobs",
"description": "Successful job processing attempts over five minutes",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(increase(messenger_jobs_total{outcome=\"success\"}[5m])) or (0 * sum(increase(messenger_jobs_total[5m])))",
"legendFormat": "Successful jobs",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"min": 0,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "auto"
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
},
{
"id": 5,
"title": "Failed Jobs and Retries",
"description": "Failed and retried job attempts over five minutes",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(increase(messenger_jobs_total{outcome=~\"failed|error\"}[5m])) or (0 * sum(increase(messenger_jobs_total[5m])))",
"legendFormat": "Failed attempts",
"range": true
},
{
"refId": "B",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum(increase(messenger_jobs_total{outcome=\"retry\"}[5m])) or (0 * sum(increase(messenger_jobs_total[5m])))",
"legendFormat": "Retries",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "short",
"min": 0,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "auto"
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
},
{
"id": 6,
"title": "Job Processing Duration",
"description": "Mean job processing duration by outcome",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (outcome) (rate(messenger_job_duration_seconds_sum[$__rate_interval])) / sum by (outcome) (rate(messenger_job_duration_seconds_count[$__rate_interval]))",
"legendFormat": "{{outcome}}",
"range": true
}
],
"fieldConfig": {
"defaults": {
"unit": "s",
"min": 0,
"custom": {
"drawStyle": "line",
"lineWidth": 2,
"fillOpacity": 10,
"showPoints": "auto"
}
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
}
}
]
}
@@ -0,0 +1,12 @@
apiVersion: 1
providers:
- name: Lab6
orgId: 1
folder: Lab6
type: file
disableDeletion: false
editable: false
updateIntervalSeconds: 10
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,40 @@
apiVersion: 1
datasources:
- name: Prometheus
uid: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: false
- name: Loki
uid: loki
type: loki
access: proxy
url: http://loki:3100
editable: false
jsonData:
derivedFields:
- name: TraceID
matcherRegex: '"trace_id"\s*:\s*"([a-f0-9]{32})"'
datasourceUid: tempo
url: '$${__value.raw}'
- name: Tempo
uid: tempo
type: tempo
access: proxy
url: http://tempo:3200
editable: false
jsonData:
tracesToLogsV2:
datasourceUid: loki
spanStartTimeShift: '-5m'
spanEndTimeShift: '5m'
filterByTraceID: true
filterBySpanID: false
tags:
- key: service.name
value: service_name