Prepare verified laboratory 6 implementation and evidence

This commit is contained in:
rey
2026-11-17 17:32:06 +03:00
parent 470d9d6f1e
commit 7d56e52fd0
335 changed files with 31206 additions and 72 deletions
+631
View File
@@ -0,0 +1,631 @@
{
"uid": "messenger",
"title": "Messenger - OpenObserve",
"schemaVersion": 41,
"version": 1,
"refresh": "5s",
"time": {
"from": "now-15m",
"to": "now"
},
"tags": [
"mtuci",
"lab6",
"OpenObserve"
],
"panels": [
{
"id": 1,
"type": "timeseries",
"title": "RPS",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum(rate(http_requests[30s]))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "reqps"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 2,
"type": "timeseries",
"title": "5xx ratio",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 0,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "(sum(rate(http_requests{status_class=\"5xx\"}[30s])) or vector(0)) / clamp_min(sum(rate(http_requests[30s])),0.001)",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 3,
"type": "timeseries",
"title": "API p50",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.50, sum by(le)(rate(http_duration_bucket[30s])))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 4,
"type": "timeseries",
"title": "API p95",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 8,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95, sum by(le)(rate(http_duration_bucket[30s])))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 5,
"type": "timeseries",
"title": "API p99",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.99, sum by(le)(rate(http_duration_bucket[30s])))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 6,
"type": "timeseries",
"title": "Oldest queued job",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 16,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max((queue_oldest_age_seconds and (timestamp(queue_oldest_age_seconds) > time()-10)))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 7,
"type": "timeseries",
"title": "Queue depth",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 24,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max((queue_depth and (timestamp(queue_depth) > time()-10)))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 8,
"type": "timeseries",
"title": "DB pool usage",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 24,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum((db_pool_used and (timestamp(db_pool_used) > time()-10))) / clamp_min(sum((db_pool_capacity and (timestamp(db_pool_capacity) > time()-10))),1)",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 9,
"type": "timeseries",
"title": "Worker saturation",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 32,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum((worker_busy and (timestamp(worker_busy) > time()-10))) / clamp_min(sum((worker_capacity and (timestamp(worker_capacity) > time()-10))),1)",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 10,
"type": "timeseries",
"title": "Job outcomes",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 32,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum by(outcome)(rate(jobs_processed[30s]))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "ops"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 11,
"type": "timeseries",
"title": "Job p95",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 40,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95,sum by(le)(rate(job_duration_bucket[30s])))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 12,
"type": "timeseries",
"title": "Time to ready p95",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 40,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95,sum by(le)(rate(time_to_ready_bucket[30s])))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 13,
"type": "timeseries",
"title": "DB pending acquires",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 48,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum((db_pool_pending_acquires and (timestamp(db_pool_pending_acquires) > time()-10)))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 14,
"type": "timeseries",
"title": "DB acquire p95",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 48,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "histogram_quantile(0.95,sum by(le)(rate(db_pool_acquire_duration_bucket[30s])))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "s"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 15,
"type": "timeseries",
"title": "Database observer available",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 56,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "min((database_observer_up and (timestamp(database_observer_up) > time()-10)))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "short"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 16,
"type": "timeseries",
"title": "Missed ready deadline (matured5m cohort)",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 56,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "max((((ready_slo_matured_300s - on(service_name,service_instance_id) ready_slo_timely_300s) / on(service_name,service_instance_id) clamp_min(ready_slo_matured_300s,1)) and on(service_name,service_instance_id) (database_observer_up == 1)) and on(service_name,service_instance_id) (timestamp(ready_slo_matured_300s) > time()-10) and on(service_name,service_instance_id) (timestamp(database_observer_up) > time()-10))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "percentunit"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 17,
"type": "timeseries",
"title": "Process RSS",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 0,
"y": 64,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum by(service_name)((process_resident_memory_bytes and (timestamp(process_resident_memory_bytes) > time()-10)))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "bytes"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
},
{
"id": 18,
"type": "timeseries",
"title": "Process CPU (cores)",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"gridPos": {
"x": 12,
"y": 64,
"w": 12,
"h": 8
},
"targets": [
{
"refId": "A",
"expr": "sum by(service_name)(rate(process_cpu[30s]))",
"legendFormat": "__auto"
}
],
"fieldConfig": {
"defaults": {
"unit": "none"
},
"overrides": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom"
}
}
}
],
"description": "Current native OpenObserve metric names. Gauge samples older than10s are excluded. Logs and canonical traces use the provisioned OpenObserve datasource in Explore; optional plugin dashboard/service-map paths are outside this acceptance."
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
apiVersion: 1
providers:
- name: Messenger
orgId: 1
folder: Coursework
type: file
disableDeletion: true
editable: false
options:
path: /var/lib/grafana/dashboards
@@ -0,0 +1,39 @@
apiVersion: 1
datasources:
- name: OpenObserve Metrics
uid: prometheus
type: prometheus
access: proxy
url: http://observe-query:5082/api/default/prometheus
basicAuth: true
basicAuthUser: $O2_QUERY_USER
secureJsonData:
basicAuthPassword: $O2_QUERY_PASSWORD
isDefault: true
editable: false
jsonData:
httpMethod: GET
timeInterval: 2s
queryTimeout: 5s
- name: OpenObserve Logs and Traces
uid: openobserve
type: openobserve
access: proxy
url: http://observe-query:5082
basicAuth: true
basicAuthUser: $O2_QUERY_USER
secureJsonData:
basicAuthPassword: $O2_QUERY_PASSWORD
editable: false
jsonData:
timestamp_column: _timestamp
default_organization: default
default_log_stream: messenger
default_trace_stream: messenger
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: status_code
duration_field: duration
+27
View File
@@ -0,0 +1,27 @@
global
log stdout format raw local0
maxconn 256
defaults
mode http
log global
timeout connect 1s
timeout client 20s
timeout server 25s
retries 0
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 2
timeout resolve 1s
timeout retry 1s
hold valid 1s
hold obsolete 1s
frontend public
bind :8080
default_backend api
backend api
balance roundrobin
option httpchk
http-check send meth GET uri /health/ready
http-check expect status 200
default-server inter 500ms fall 2 rise 1
server-template replica 1-4 api:8080 check resolvers docker resolve-prefer ipv4 init-addr none
+76
View File
@@ -0,0 +1,76 @@
global
maxconn 16
nbthread 1
tune.bufsize 131072
defaults
mode http
timeout connect 1s
timeout client 10s
timeout server 10s
timeout http-request 3s
timeout http-keep-alive 1s
timeout queue 1s
frontend query
bind :5082
acl authenticated http_auth(query_users)
http-request auth realm VP6-telemetry if !authenticated
acl read_method method GET
acl search_method method POST
acl search_path path -m str /api/default/_search
acl read_path path -m str /api/organizations /api/default/streams
acl read_path path_reg ^/api/default/streams/[A-Za-z0-9_]+/schema$
acl read_path path -m str /api/default/messenger/_values
acl read_path path_reg ^/api/default/prometheus/api/v1/(query|query_range|labels|series|metadata)$
acl read_path path_reg ^/api/default/prometheus/api/v1/label/[A-Za-z0-9_]+/values$
http-request deny deny_status 403 unless read_method read_path or search_method search_path
http-request wait-for-body time 2s if search_method search_path
http-request deny deny_status 413 if search_method search_path { req.body_len gt 65536 }
http-request set-var(txn.rows) req.body,json_query('$.query.size','int') if search_method search_path
http-request set-var(txn.begin) req.body,json_query('$.query.start_time','int') if search_method search_path
http-request set-var(txn.end) req.body,json_query('$.query.end_time','int') if search_method search_path
http-request set-var(txn.window) var(txn.end),sub(txn.begin) if search_method search_path
# Native supplementary histogram omits size; preserve that default and explicit zero.
acl search_size_present req.body,json_query('$.query.size') -m found
http-request deny deny_status 400 if search_method search_path search_size_present !{ var(txn.rows) -m int 0:1000 }
http-request deny deny_status 400 if search_method search_path !{ var(txn.begin) -m int gt 0 }
http-request deny deny_status 400 if search_method search_path !{ var(txn.window) -m int 1:3600000000 }
# Reject duplicate protected URL parameters after native URL decoding.
acl duplicate_query query,url_dec -m reg (^|&)size=[^&]*(&[^&]*)*&size= (^|&)start_time=[^&]*(&[^&]*)*&start_time= (^|&)end_time=[^&]*(&[^&]*)*&end_time= (^|&)start=[^&]*(&[^&]*)*&start= (^|&)end=[^&]*(&[^&]*)*&end= (^|&)query=[^&]*(&[^&]*)*&query=
http-request deny deny_status 400 if read_method duplicate_query
acl values_path path -m str /api/default/messenger/_values
http-request set-var(txn.rows) url_param(size),add(0) if read_method values_path
http-request set-var(txn.begin) url_param(start_time),add(0) if read_method values_path
http-request set-var(txn.end) url_param(end_time),add(0) if read_method values_path
http-request set-var(txn.window) var(txn.end),sub(txn.begin) if read_method values_path
http-request deny deny_status 400 if read_method values_path !{ var(txn.rows) -m int 1:1000 }
http-request deny deny_status 400 if read_method values_path !{ var(txn.window) -m int 1:3600000000 }
# Integer epoch parts give a conservative actual range strictly below3600s;
# a same-second range is rejected so fractional inversions cannot pass.
acl range_path path -m str /api/default/prometheus/api/v1/query_range
http-request set-var(txn.begin_s) url_param(start),field(1,.),add(0) if read_method range_path
http-request set-var(txn.end_s) url_param(end),field(1,.),add(0) if read_method range_path
http-request set-var(txn.window_s) var(txn.end_s),sub(txn.begin_s) if read_method range_path
http-request deny deny_status 400 if read_method range_path !{ var(txn.begin_s) -m int gt 0 }
http-request deny deny_status 400 if read_method range_path !{ var(txn.window_s) -m int 1:3599 }
default_backend observe
resolvers docker
nameserver dns 127.0.0.11:53
resolve_retries 3
timeout resolve 1s
timeout retry 1s
hold valid 1s
backend observe
# Bound only recognized native OO HTTP responses, before Grafana frontend proxying.
# Reject unknown framing/encoding; this is not a streaming byte counter or decompressor.
http-request set-header Accept-Encoding identity
acl response_encoded res.fhdr_cnt(Content-Encoding) gt 0
acl response_transfer_encoded res.fhdr_cnt(Transfer-Encoding) gt 0
acl response_length_single res.fhdr_cnt(Content-Length) eq 1
acl response_length_canonical res.fhdr(Content-Length) -m reg ^(0|[1-9][0-9]{0,6})$
acl response_length_excessive res.fhdr(Content-Length) -m int gt 1048576
http-response return status 502 content-type application/json string '{"error":"query_response_boundary"}' if response_encoded or response_transfer_encoded or !response_length_single or !response_length_canonical or response_length_excessive
server own openobserve:5080 maxconn 4 maxqueue 8 resolvers docker init-addr libc,none
+72
View File
@@ -0,0 +1,72 @@
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
processors:
memory_limiter:
check_interval: 1s
limit_mib: 128
spike_limit_mib: 32
batch:
send_batch_size: 64
send_batch_max_size: 128
timeout: 1s
exporters:
otlp_http/openobserve:
endpoint: http://openobserve:5080/api/default
headers:
Authorization: ${file:/run/secrets/openobserve_ingest_auth}
stream-name: messenger
timeout: 2s
sending_queue:
sizer: bytes
queue_size: 8388608
num_consumers: 2
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 3s
max_elapsed_time: 5s
otlp_http/openobserve_metrics:
endpoint: http://openobserve:5080/api/default
headers:
Authorization: ${file:/run/secrets/openobserve_ingest_auth}
timeout: 2s
sending_queue:
sizer: bytes
queue_size: 8388608
num_consumers: 2
retry_on_failure:
enabled: true
initial_interval: 1s
max_interval: 3s
max_elapsed_time: 5s
extensions:
health_check:
endpoint: 0.0.0.0:13133
service:
telemetry:
logs:
level: warn
metrics:
readers:
- pull:
exporter:
prometheus:
host: 0.0.0.0
port: 8888
extensions: [health_check]
pipelines:
traces:
receivers: [otlp]
processors: [memory_limiter,batch]
exporters: [otlp_http/openobserve]
metrics:
receivers: [otlp]
processors: [memory_limiter,batch]
exporters: [otlp_http/openobserve_metrics]
logs:
receivers: [otlp]
processors: [memory_limiter,batch]
exporters: [otlp_http/openobserve]