264 lines
14 KiB
Plaintext
264 lines
14 KiB
Plaintext
# Наблюдаемость: контрольный запрос (trace + логи), dashboard, перцентили, приватность, правила
|
||
# date: 2026-11-20T13:59:52Z
|
||
# commit: 5f870e4
|
||
|
||
## Prometheus: правила загружены (promtool и /api/v1/rules)
|
||
$ docker compose exec -T prometheus promtool check rules /etc/prometheus/rules/messenger.yml
|
||
Error response from daemon: Container 81bb4c2a806cbf4ed34b6b599f104167debe5fefbeeef14753ba2eec67350329 is restarting, wait until the container is running
|
||
EXIT CODE 1
|
||
|
||
$ sh -c wget -qO- http://grafana:3000/api/datasources/proxy/uid/prometheus/api/v1/rules | python3 -c 'import json,sys; [print(r["type"], r["name"], r["health"]) for g in json.load(sys.stdin)["data"]["groups"] for r in g["rules"]]'
|
||
wget: bad address 'grafana:3000'
|
||
Traceback (most recent call last):
|
||
File "<string>", line 1, in <module>
|
||
File "/usr/lib/python3.12/json/__init__.py", line 293, in load
|
||
return loads(fp.read(),
|
||
^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
|
||
return _default_decoder.decode(s)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 338, in decode
|
||
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 356, in raw_decode
|
||
raise JSONDecodeError("Expecting value", s, err.value) from None
|
||
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
|
||
EXIT CODE 1
|
||
|
||
## Grafana: datasources с фиксированными UID, dashboard из provisioning
|
||
$ sh -c for uid in prometheus loki tempo; do wget -qO- http://grafana:3000/api/datasources/uid/$uid | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d["uid"], d["type"], d["url"])'; done
|
||
wget: bad address 'grafana:3000'
|
||
Traceback (most recent call last):
|
||
File "<string>", line 1, in <module>
|
||
File "/usr/lib/python3.12/json/__init__.py", line 293, in load
|
||
return loads(fp.read(),
|
||
^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
|
||
return _default_decoder.decode(s)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 338, in decode
|
||
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 356, in raw_decode
|
||
raise JSONDecodeError("Expecting value", s, err.value) from None
|
||
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
|
||
wget: bad address 'grafana:3000'
|
||
Traceback (most recent call last):
|
||
File "<string>", line 1, in <module>
|
||
File "/usr/lib/python3.12/json/__init__.py", line 293, in load
|
||
return loads(fp.read(),
|
||
^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
|
||
return _default_decoder.decode(s)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 338, in decode
|
||
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 356, in raw_decode
|
||
raise JSONDecodeError("Expecting value", s, err.value) from None
|
||
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
|
||
wget: bad address 'grafana:3000'
|
||
Traceback (most recent call last):
|
||
File "<string>", line 1, in <module>
|
||
File "/usr/lib/python3.12/json/__init__.py", line 293, in load
|
||
return loads(fp.read(),
|
||
^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/__init__.py", line 346, in loads
|
||
return _default_decoder.decode(s)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 338, in decode
|
||
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/json/decoder.py", line 356, in raw_decode
|
||
raise JSONDecodeError("Expecting value", s, err.value) from None
|
||
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
|
||
EXIT CODE 1
|
||
|
||
## Контрольный upload с клиентским traceparent: trace в Tempo и логи в Loki
|
||
$ python3 scripts/trace-check.py
|
||
Traceback (most recent call last):
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1344, in do_open
|
||
h.request(req.get_method(), req.selector, req.data, headers,
|
||
File "/usr/lib/python3.12/http/client.py", line 1358, in request
|
||
self._send_request(method, url, body, headers, encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1404, in _send_request
|
||
self.endheaders(body, encode_chunked=encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1353, in endheaders
|
||
self._send_output(message_body, encode_chunked=encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1113, in _send_output
|
||
self.send(msg)
|
||
File "/usr/lib/python3.12/http/client.py", line 1057, in send
|
||
self.connect()
|
||
File "/usr/lib/python3.12/http/client.py", line 1023, in connect
|
||
self.sock = self._create_connection(
|
||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/socket.py", line 841, in create_connection
|
||
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/socket.py", line 978, in getaddrinfo
|
||
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
socket.gaierror: [Errno -2] Name does not resolve
|
||
|
||
During handling of the above exception, another exception occurred:
|
||
|
||
Traceback (most recent call last):
|
||
File "/work/scripts/trace-check.py", line 134, in <module>
|
||
main()
|
||
File "/work/scripts/trace-check.py", line 72, in main
|
||
auth, chat = session()
|
||
^^^^^^^^^
|
||
File "/work/scripts/trace-check.py", line 37, in session
|
||
_, user = call('POST', BASE + '/api/v1/users', {'username': username, 'display_name': 'Trace check', 'password': password})
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/work/scripts/trace-check.py", line 28, in call
|
||
with urllib.request.urlopen(request, timeout=15) as response:
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
|
||
return opener.open(url, data, timeout)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 515, in open
|
||
response = self._open(req, data)
|
||
^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 532, in _open
|
||
result = self._call_chain(self.handle_open, protocol, protocol +
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
|
||
result = func(*args)
|
||
^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1373, in http_open
|
||
return self.do_open(http.client.HTTPConnection, req)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1347, in do_open
|
||
raise URLError(err)
|
||
urllib.error.URLError: <urlopen error [Errno -2] Name does not resolve>
|
||
EXIT CODE 1
|
||
|
||
## Секреты и содержимое не попадают в telemetry; в labels метрик нет ID
|
||
$ python3 scripts/telemetry-privacy.py
|
||
Traceback (most recent call last):
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1344, in do_open
|
||
h.request(req.get_method(), req.selector, req.data, headers,
|
||
File "/usr/lib/python3.12/http/client.py", line 1358, in request
|
||
self._send_request(method, url, body, headers, encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1404, in _send_request
|
||
self.endheaders(body, encode_chunked=encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1353, in endheaders
|
||
self._send_output(message_body, encode_chunked=encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1113, in _send_output
|
||
self.send(msg)
|
||
File "/usr/lib/python3.12/http/client.py", line 1057, in send
|
||
self.connect()
|
||
File "/usr/lib/python3.12/http/client.py", line 1023, in connect
|
||
self.sock = self._create_connection(
|
||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/socket.py", line 841, in create_connection
|
||
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/socket.py", line 978, in getaddrinfo
|
||
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
socket.gaierror: [Errno -2] Name does not resolve
|
||
|
||
During handling of the above exception, another exception occurred:
|
||
|
||
Traceback (most recent call last):
|
||
File "/work/scripts/telemetry-privacy.py", line 102, in <module>
|
||
main()
|
||
File "/work/scripts/telemetry-privacy.py", line 51, in main
|
||
user = call('POST', '/api/v1/users', {'username': username, 'display_name': 'Privacy', 'password': secrets['password']}, traced())
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/work/scripts/telemetry-privacy.py", line 27, in call
|
||
with urllib.request.urlopen(urllib.request.Request(BASE + path, data=data, method=method, headers=headers), timeout=15) as r:
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
|
||
return opener.open(url, data, timeout)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 515, in open
|
||
response = self._open(req, data)
|
||
^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 532, in _open
|
||
result = self._call_chain(self.handle_open, protocol, protocol +
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
|
||
result = func(*args)
|
||
^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1373, in http_open
|
||
return self.do_open(http.client.HTTPConnection, req)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1347, in do_open
|
||
raise URLError(err)
|
||
urllib.error.URLError: <urlopen error [Errno -2] Name does not resolve>
|
||
EXIT CODE 1
|
||
|
||
## Перцентили dashboard против клиентского замера tests/load.py
|
||
$ python3 scripts/latency-compare.py --duration 30
|
||
Traceback (most recent call last):
|
||
File "/work/scripts/latency-compare.py", line 52, in <module>
|
||
main()
|
||
File "/work/scripts/latency-compare.py", line 31, in main
|
||
subprocess.run([sys.executable, 'tests/load.py', '--base-url', BASE, '--duration', duration, '--output', output],
|
||
File "/usr/lib/python3.12/subprocess.py", line 571, in run
|
||
raise CalledProcessError(retcode, process.args,
|
||
subprocess.CalledProcessError: Command '['/usr/bin/python3', 'tests/load.py', '--base-url', 'http://lb:8080', '--duration', '30', '--output', '/tmp/tmpn5jz4yx8/load.json']' returned non-zero exit status 1.
|
||
EXIT CODE 1
|
||
|
||
## Все запросы dashboard (пустые панели alerts/WARN-логов допустимы без инцидентов)
|
||
$ python3 scripts/dashboard-check.py
|
||
Traceback (most recent call last):
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1344, in do_open
|
||
h.request(req.get_method(), req.selector, req.data, headers,
|
||
File "/usr/lib/python3.12/http/client.py", line 1358, in request
|
||
self._send_request(method, url, body, headers, encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1404, in _send_request
|
||
self.endheaders(body, encode_chunked=encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1353, in endheaders
|
||
self._send_output(message_body, encode_chunked=encode_chunked)
|
||
File "/usr/lib/python3.12/http/client.py", line 1113, in _send_output
|
||
self.send(msg)
|
||
File "/usr/lib/python3.12/http/client.py", line 1057, in send
|
||
self.connect()
|
||
File "/usr/lib/python3.12/http/client.py", line 1023, in connect
|
||
self.sock = self._create_connection(
|
||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/socket.py", line 841, in create_connection
|
||
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/socket.py", line 978, in getaddrinfo
|
||
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
socket.gaierror: [Errno -2] Name does not resolve
|
||
|
||
During handling of the above exception, another exception occurred:
|
||
|
||
Traceback (most recent call last):
|
||
File "/work/scripts/dashboard-check.py", line 57, in <module>
|
||
main()
|
||
File "/work/scripts/dashboard-check.py", line 43, in main
|
||
grafana = get('/api/dashboards/uid/messenger-overview')
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/work/scripts/dashboard-check.py", line 19, in get
|
||
with urllib.request.urlopen(url, timeout=15) as response:
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
|
||
return opener.open(url, data, timeout)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 515, in open
|
||
response = self._open(req, data)
|
||
^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 532, in _open
|
||
result = self._call_chain(self.handle_open, protocol, protocol +
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
|
||
result = func(*args)
|
||
^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1373, in http_open
|
||
return self.do_open(http.client.HTTPConnection, req)
|
||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
File "/usr/lib/python3.12/urllib/request.py", line 1347, in do_open
|
||
raise URLError(err)
|
||
urllib.error.URLError: <urlopen error [Errno -2] Name does not resolve>
|
||
EXIT CODE 1
|
||
|
||
## Пример структурного лога (stdout API)
|