feat(logging): enhance HTTP request logging with additional payload details

- Introduced new fields in the HttpPageFetchLog model to capture request and response headers, bodies, and method for improved logging granularity.
- Updated the logging service to serialize and store these new details during HTTP fetch operations, enhancing traceability and debugging capabilities.
- Modified the clickTtHttpPageRoutes to include the new logging features, allowing for optional payload inclusion in log queries.
This commit is contained in:
Torsten Schulz (local)
2026-03-10 22:26:37 +01:00
parent 4f3a1829ca
commit 0e4d1707fd
6 changed files with 143 additions and 23 deletions

View File

@@ -0,0 +1,10 @@
ALTER TABLE http_page_fetch_log
ADD COLUMN IF NOT EXISTS request_method VARCHAR(16) NULL COMMENT 'HTTP-Methode des ausgehenden Requests' AFTER club_id_param,
ADD COLUMN IF NOT EXISTS request_headers LONGTEXT NULL COMMENT 'Gesendete Request-Header als JSON' AFTER request_method,
ADD COLUMN IF NOT EXISTS request_body LONGTEXT NULL COMMENT 'Gesendeter Request-Body im Originalformat' AFTER request_headers,
ADD COLUMN IF NOT EXISTS response_headers LONGTEXT NULL COMMENT 'Empfangene Response-Header als JSON' AFTER content_type,
ADD COLUMN IF NOT EXISTS response_body LONGTEXT NULL COMMENT 'Vollstaendiger Response-Body' AFTER response_headers,
ADD COLUMN IF NOT EXISTS response_url TEXT NULL COMMENT 'Finale Response-URL nach Redirects' AFTER response_body;
ALTER TABLE http_page_fetch_log
MODIFY COLUMN response_snippet LONGTEXT NULL COMMENT 'Gekuerzter oder kompletter Response-Anfang zur Strukturanalyse';

View File

@@ -10,10 +10,16 @@ CREATE TABLE IF NOT EXISTS http_page_fetch_log (
association VARCHAR(64) NULL COMMENT 'Verband (z.B. HeTTV, RTTV)',
championship VARCHAR(128) NULL COMMENT 'Championship-Parameter (z.B. HTTV 25/26)',
club_id_param VARCHAR(64) NULL COMMENT 'Club-ID falls clubInfoDisplay',
request_method VARCHAR(16) NULL COMMENT 'HTTP-Methode des ausgehenden Requests',
request_headers LONGTEXT NULL COMMENT 'Gesendete Request-Header als JSON',
request_body LONGTEXT NULL COMMENT 'Gesendeter Request-Body im Originalformat',
http_status INT NULL COMMENT 'HTTP-Status der Response',
success BOOLEAN NOT NULL DEFAULT FALSE,
response_snippet TEXT NULL COMMENT 'Gekürzter Response-Anfang (max 2000 Zeichen) zur Strukturanalyse',
content_type VARCHAR(128) NULL COMMENT 'Content-Type der Response',
response_headers LONGTEXT NULL COMMENT 'Empfangene Response-Header als JSON',
response_body LONGTEXT NULL COMMENT 'Vollständiger Response-Body',
response_url TEXT NULL COMMENT 'Finale Response-URL nach Redirects',
error_message TEXT NULL,
execution_time_ms INT NULL COMMENT 'Laufzeit in Millisekunden',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,