Prepare verified laboratory 7 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 20afc2c790
commit eb1b5c7b84
677 changed files with 208256 additions and 64 deletions
+603
View File
@@ -0,0 +1,603 @@
{
"uid": "messenger-security",
"title": "Messenger lab7 security and pipeline",
"schemaVersion": 39,
"version": 1,
"editable": false,
"time": {
"from": "now-15m",
"to": "now"
},
"refresh": "5s",
"panels": [
{
"id": 1,
"title": "Requests / second",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum(rate(http_requests[1m]))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 2,
"title": "HTTP p50 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.50,sum by (le)(rate(http_duration_bucket[1m])))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 3,
"title": "HTTP p99 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.99,sum by (le)(rate(http_duration_bucket[1m])))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 4,
"title": "HTTP server error ratio",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "(sum(rate(http_requests{status_class=\"5xx\"}[1m])) or vector(0)) / clamp_min(sum(rate(http_requests[1m])),0.001)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 5,
"title": "HTTP p95 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95,sum by (le)(rate(http_duration_bucket[1m])))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 6,
"title": "Jobs by outcome",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum by (outcome)(rate(jobs_processed[1m]))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 7,
"title": "Job duration p95 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 24,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95,sum by(le)(rate(job_duration_bucket[1m])))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 8,
"title": "Time to ready p95 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 24,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95,sum by(le)(rate(time_to_ready_bucket[1m])))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 9,
"title": "Oldest unfinished job seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 32,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max(queue_oldest_age_seconds)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 10,
"title": "Unfinished jobs",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 32,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max(queue_depth)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 11,
"title": "Worker busy",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 40,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum(worker_busy)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 12,
"title": "Worker capacity",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 40,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum((worker_capacity and (timestamp(worker_capacity) > time()-10)))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 13,
"title": "Database observer up",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 48,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "min((database_observer_up and (timestamp(database_observer_up) > time()-10)))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 14,
"title": "Database pool used",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 48,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum(db_pool_used)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 15,
"title": "Database pending acquires",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 56,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum(db_pool_pending_acquires)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 16,
"title": "Database pool capacity",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 56,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum((db_pool_capacity and (timestamp(db_pool_capacity)>time()-10)))"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 17,
"title": "Ready within 10 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 64,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max(ready_slo_timely_10s) / clamp_min(max(ready_slo_matured_10s),1)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 18,
"title": "Ready within 30 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 64,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max(ready_slo_timely_30s) / clamp_min(max(ready_slo_matured_30s),1)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 19,
"title": "Ready within 300 seconds",
"type": "timeseries",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 72,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max(ready_slo_timely_300s) / clamp_min(max(ready_slo_matured_300s),1)"
}
],
"fieldConfig": {
"defaults": {},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
}
]
}
@@ -0,0 +1,95 @@
apiVersion: 1
groups:
- orgId: 1
name: messenger-security
folder: Messenger lab7
interval: 10s
rules:
- uid: vp7-server-errors
title: Messenger server error ratio
condition: C
for: 30s
noDataState: NoData
execErrState: Error
isPaused: false
labels: { severity: warning, service: messenger-api }
annotations:
summary: API server error ratio exceeds five percent
runbook: RUN.md, telemetry incidents
data:
- refId: A
datasourceUid: prometheus
relativeTimeRange: { from: 60, to: 0 }
model:
datasource: { type: prometheus, uid: prometheus }
expr: (sum(rate(http_requests{status_class="5xx"}[1m])) or vector(0)) / clamp_min(sum(rate(http_requests[1m])),0.001)
instant: true
range: false
refId: A
- refId: B
datasourceUid: __expr__
relativeTimeRange: { from: 0, to: 0 }
model:
datasource: { type: __expr__, uid: __expr__ }
expression: A
type: reduce
reducer: last
refId: B
- refId: C
datasourceUid: __expr__
relativeTimeRange: { from: 0, to: 0 }
model:
datasource: { type: __expr__, uid: __expr__ }
expression: B
type: threshold
refId: C
conditions:
- evaluator: { type: gt, params: [0.05] }
operator: { type: and }
query: { params: [C] }
reducer: { type: last, params: [] }
type: query
- uid: vp7-old-jobs
title: Messenger oldest unfinished job
condition: C
for: 15s
noDataState: NoData
execErrState: Error
isPaused: false
labels: { severity: warning, service: messenger-worker }
annotations:
summary: An unfinished attachment job is older than thirty seconds
runbook: RUN.md, worker backlog recovery
data:
- refId: A
datasourceUid: prometheus
relativeTimeRange: { from: 60, to: 0 }
model:
datasource: { type: prometheus, uid: prometheus }
expr: max(queue_oldest_age_seconds)
instant: true
range: false
refId: A
- refId: B
datasourceUid: __expr__
relativeTimeRange: { from: 0, to: 0 }
model:
datasource: { type: __expr__, uid: __expr__ }
expression: A
type: reduce
reducer: last
refId: B
- refId: C
datasourceUid: __expr__
relativeTimeRange: { from: 0, to: 0 }
model:
datasource: { type: __expr__, uid: __expr__ }
expression: B
type: threshold
refId: C
conditions:
- evaluator: { type: gt, params: [30] }
operator: { type: and }
query: { params: [C] }
reducer: { type: last, params: [] }
type: query
@@ -0,0 +1,8 @@
apiVersion: 1
providers:
- name: Messenger
type: file
disableDeletion: true
editable: false
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,36 @@
apiVersion: 1
datasources:
- name: OpenObserve metrics
uid: prometheus
type: prometheus
access: proxy
url: http://127.0.0.1:15080/api/default/prometheus
isDefault: true
editable: false
basicAuth: true
basicAuthUser: $OO_QUERY_USER
secureJsonData:
basicAuthPassword: $OO_QUERY_PASSWORD
jsonData:
httpMethod: GET
- name: OpenObserve logs and traces
uid: openobserve
type: openobserve
access: proxy
url: http://127.0.0.1:15080
editable: false
basicAuth: true
basicAuthUser: $OO_QUERY_USER
secureJsonData:
basicAuthPassword: $OO_QUERY_PASSWORD
jsonData:
default_organization: default
default_log_stream: messenger
default_trace_stream: messenger
timestamp_column: _timestamp
log_message_field: body
trace_id_field: trace_id
span_id_field: span_id
service_name_field: service_name
span_name_field: operation_name
status_field: span_status