revise July 2020 logging articles
Build and deploy / deploy (push) Successful in 13s

This commit is contained in:
2026-07-31 11:36:52 +03:00
parent 6c4f980f51
commit 8ae2b93876
7 changed files with 740 additions and 1 deletions
@@ -0,0 +1,48 @@
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="1320" viewBox="0 0 720 1320" role="img" aria-labelledby="title desc">
<title id="title">Корреляция одного запроса через request_id</title>
<desc id="desc">Вертикальная схема показывает один синтетический HTTP-запрос: gateway создаёт или проверяет request_id, передаёт его дочернему логгеру и HTTP-клиенту, catalog API пишет то же значение, затем JSONL-запрос собирает события.</desc>
<defs>
<linearGradient id="background" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#15122d"/>
<stop offset="1" stop-color="#25365b"/>
</linearGradient>
<marker id="arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto">
<path d="M0,0 L12,6 L0,12 Z" fill="#7de0ff"/>
</marker>
</defs>
<rect width="720" height="1320" fill="url(#background)"/>
<text x="64" y="72" fill="#e9f8ff" font-family="Arial, sans-serif" font-size="34" font-weight="700">ОДИН request_id ЧЕРЕЗ ГРАНИЦЫ</text>
<text x="64" y="108" fill="#b4c5e8" font-family="Arial, sans-serif" font-size="22">Корреляция учебного запроса, не trace critical path</text>
<rect x="56" y="156" width="608" height="172" rx="24" fill="#22335e" stroke="#7de0ff" stroke-width="2"/>
<text x="88" y="202" fill="#9bdfff" font-family="Arial, sans-serif" font-size="24" font-weight="700">ВХОД В GATEWAY</text>
<text x="88" y="246" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">Проверить X-Request-Id</text>
<text x="88" y="282" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">или создать req-demo-20200714-01</text>
<path d="M360 328 L360 384" stroke="#7de0ff" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="402" width="608" height="190" rx="24" fill="#22335e" stroke="#7de0ff" stroke-width="2"/>
<text x="88" y="448" fill="#9bdfff" font-family="Arial, sans-serif" font-size="24" font-weight="700">ДВА ЯВНЫХ КАНАЛА</text>
<text x="88" y="492" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">child logger → JSON event</text>
<text x="88" y="528" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">HTTP header → следующий сервис</text>
<text x="88" y="568" fill="#c5d3ee" font-family="Arial, sans-serif" font-size="22">Не глобальная переменная</text>
<path d="M360 592 L360 648" stroke="#7de0ff" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="666" width="608" height="192" rx="24" fill="#22335e" stroke="#78e0c4" stroke-width="2"/>
<text x="88" y="712" fill="#91f0d2" font-family="Arial, sans-serif" font-size="24" font-weight="700">CATALOG API</text>
<text x="88" y="756" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">catalog.reserve.started</text>
<text x="88" y="792" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">request_id тот же</text>
<text x="88" y="832" fill="#c5d3ee" font-family="Arial, sans-serif" font-size="22">Добавляет только свой контекст</text>
<path d="M360 858 L360 914" stroke="#7de0ff" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="932" width="608" height="192" rx="24" fill="#22335e" stroke="#f1c970" stroke-width="2"/>
<text x="88" y="978" fill="#ffe09a" font-family="Arial, sans-serif" font-size="24" font-weight="700">УЧЕБНЫЙ ПОИСК JSONL</text>
<text x="88" y="1022" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">select(request_id == …01)</text>
<text x="88" y="1058" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">вход → операция → ответ</text>
<text x="88" y="1098" fill="#c5d3ee" font-family="Arial, sans-serif" font-size="22">Проверяет связь, не причинность</text>
<rect x="56" y="1174" width="608" height="88" rx="20" fill="#312142" stroke="#ff9eb4" stroke-width="2"/>
<text x="88" y="1228" fill="#ffd4df" font-family="Arial, sans-serif" font-size="24" font-weight="700">Нет spans · нет SLO · нет production-замера</text>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

@@ -0,0 +1,50 @@
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="1360" viewBox="0 0 720 1360" role="img" aria-labelledby="title desc">
<title id="title">Решение о поле структурированного лога</title>
<desc id="desc">Вертикальная схема показывает решение для поля: сначала проверяется диагностический вопрос, затем чувствительность и кардинальность; поле либо исключается, редактируется, нормализуется или попадает в безопасный контекст синтетического события.</desc>
<defs>
<linearGradient id="background" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#24152b"/>
<stop offset="1" stop-color="#473047"/>
</linearGradient>
<marker id="arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto">
<path d="M0,0 L12,6 L0,12 Z" fill="#ffd071"/>
</marker>
</defs>
<rect width="720" height="1360" fill="url(#background)"/>
<text x="64" y="72" fill="#fff6dc" font-family="Arial, sans-serif" font-size="34" font-weight="700">ПОЛЕ ПРОХОДИТ ЧЕТЫРЕ ВОПРОСА</text>
<text x="64" y="108" fill="#dcc9de" font-family="Arial, sans-serif" font-size="22">Политика до сериализации учебного JSON</text>
<rect x="56" y="154" width="608" height="156" rx="24" fill="#4d354d" stroke="#ffd071" stroke-width="2"/>
<text x="88" y="202" fill="#ffe09b" font-family="Arial, sans-serif" font-size="24" font-weight="700">1. ЕСТЬ ЛИ ВОПРОС?</text>
<text x="88" y="246" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">Без проверяемого действия</text>
<text x="88" y="282" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">поле не попадает в журнал</text>
<path d="M360 310 L360 366" stroke="#ffd071" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="384" width="608" height="174" rx="24" fill="#4d354d" stroke="#ff9f9f" stroke-width="2"/>
<text x="88" y="430" fill="#ffb8b8" font-family="Arial, sans-serif" font-size="24" font-weight="700">2. ЧУВСТВИТЕЛЬНОЕ?</text>
<text x="88" y="474" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">authorization · cookie · token</text>
<text x="88" y="514" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">→ redact до JSON или исключить</text>
<path d="M360 558 L360 614" stroke="#ffd071" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="632" width="608" height="174" rx="24" fill="#4d354d" stroke="#a8d98f" stroke-width="2"/>
<text x="88" y="678" fill="#c8f3ad" font-family="Arial, sans-serif" font-size="24" font-weight="700">3. СЛИШКОМ МНОГО ЗНАЧЕНИЙ?</text>
<text x="88" y="722" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">Полный URL, id, свободный текст</text>
<text x="88" y="762" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">→ route template или error.code</text>
<path d="M360 806 L360 862" stroke="#ffd071" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="880" width="608" height="194" rx="24" fill="#4d354d" stroke="#7de0ff" stroke-width="2"/>
<text x="88" y="926" fill="#9de4ff" font-family="Arial, sans-serif" font-size="24" font-weight="700">4. БЕЗОПАСНЫЙ КОНТЕКСТ</text>
<text x="88" y="970" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">event · service · request_id</text>
<text x="88" y="1006" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">route template · status_code</text>
<text x="88" y="1048" fill="#e5d5e6" font-family="Arial, sans-serif" font-size="22">Форма ясна владельцу операции</text>
<path d="M360 1074 L360 1130" stroke="#ffd071" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="1148" width="608" height="128" rx="24" fill="#3c2d42" stroke="#ffd071" stroke-width="2"/>
<text x="88" y="1194" fill="#fff0b6" font-family="Arial, sans-serif" font-size="24" font-weight="700">ПРОВЕРКА</text>
<text x="88" y="1234" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">Один synthetic request_id → JSONL</text>
<text x="64" y="1330" fill="#dcc9de" font-family="Arial, sans-serif" font-size="22">Redaction — барьер, а не право логировать всё</text>
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

@@ -0,0 +1,48 @@
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="1280" viewBox="0 0 720 1280" role="img" aria-labelledby="title desc">
<title id="title">Контракт одного структурированного события</title>
<desc id="desc">Вертикальная схема показывает, как одно JSON-событие собирается из обязательных полей, идентификатора запроса, локального HTTP-контекста и redaction перед записью.</desc>
<defs>
<linearGradient id="background" x1="0" y1="0" x2="1" y2="1">
<stop offset="0" stop-color="#071c2c"/>
<stop offset="1" stop-color="#102a43"/>
</linearGradient>
<marker id="arrow" markerWidth="12" markerHeight="12" refX="10" refY="6" orient="auto">
<path d="M0,0 L12,6 L0,12 Z" fill="#64d9c2"/>
</marker>
</defs>
<rect width="720" height="1280" fill="url(#background)"/>
<text x="64" y="72" fill="#d9faff" font-family="Arial, sans-serif" font-size="34" font-weight="700">ОДНО СОБЫТИЕ = ОДИН ФАКТ</text>
<text x="64" y="108" fill="#91b8ca" font-family="Arial, sans-serif" font-size="22">Учебный JSON-контракт для одного request_id</text>
<rect x="56" y="154" width="608" height="206" rx="24" fill="#12344d" stroke="#64d9c2" stroke-width="2"/>
<text x="88" y="200" fill="#64d9c2" font-family="Arial, sans-serif" font-size="24" font-weight="700">1. БАЗОВЫЕ ПОЛЯ</text>
<text x="88" y="244" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">timestamp · level · service</text>
<text x="88" y="280" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">environment · короткое message</text>
<text x="88" y="326" fill="#b9d9e6" font-family="Arial, sans-serif" font-size="22">Одинаковый смысл в каждом модуле</text>
<path d="M360 360 L360 414" stroke="#64d9c2" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="432" width="608" height="194" rx="24" fill="#12344d" stroke="#73a7ff" stroke-width="2"/>
<text x="88" y="478" fill="#9bc0ff" font-family="Arial, sans-serif" font-size="24" font-weight="700">2. СВЯЗЬ ОДНОГО ЗАПРОСА</text>
<text x="88" y="524" fill="#ffffff" font-family="Arial, sans-serif" font-size="28" font-weight="700">event</text>
<text x="88" y="562" fill="#ffffff" font-family="Arial, sans-serif" font-size="28" font-weight="700">request_id</text>
<text x="88" y="602" fill="#b9d9e6" font-family="Arial, sans-serif" font-size="22">Имя из словаря, id — только для поиска</text>
<path d="M360 626 L360 680" stroke="#64d9c2" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="698" width="608" height="210" rx="24" fill="#12344d" stroke="#f5bd6a" stroke-width="2"/>
<text x="88" y="744" fill="#f5bd6a" font-family="Arial, sans-serif" font-size="24" font-weight="700">3. ЛОКАЛЬНЫЙ КОНТЕКСТ</text>
<text x="88" y="790" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">http.method · http.route</text>
<text x="88" y="826" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">http.status_code · error.code</text>
<text x="88" y="872" fill="#b9d9e6" font-family="Arial, sans-serif" font-size="22">Только поля владельца операции</text>
<path d="M360 908 L360 962" stroke="#64d9c2" stroke-width="5" marker-end="url(#arrow)"/>
<rect x="56" y="980" width="608" height="210" rx="24" fill="#1b3045" stroke="#ff8d8d" stroke-width="2"/>
<text x="88" y="1026" fill="#ffaaaa" font-family="Arial, sans-serif" font-size="24" font-weight="700">4. ДО ЗАПИСИ В JSON</text>
<text x="88" y="1072" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">redact: authorization, cookie, token</text>
<text x="88" y="1108" fill="#ffffff" font-family="Arial, sans-serif" font-size="25">route — шаблон, не полный URL</text>
<text x="88" y="1154" fill="#b9d9e6" font-family="Arial, sans-serif" font-size="22">Сначала форма события, потом stdout</text>
<text x="64" y="1240" fill="#91b8ca" font-family="Arial, sans-serif" font-size="22">Синтетический пример · не production-данные</text>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB