feat: Structured Request Logging (F11)#125
Merged
leocamello merged 4 commits intomainfrom Feb 14, 2026
Merged
Conversation
- Add comprehensive spec for structured, queryable request logs - Include correlation IDs for tracking retries and failovers - Define JSON and human-readable log formats - Ensure privacy-safe logging (no message content by default) - Support configurable log levels per component - Align with Constitution principles III, VIII, X - Include complete requirements checklist (14/14 items passed)
- Add src/logging/ module (fields.rs, middleware.rs, mod.rs) - Instrument handle_chat_completion with tracing spans - Add request_id (UUID v4) correlation across retries/fallbacks - Extend RoutingResult with route_reason field - Extend LoggingConfig with component_levels and enable_content_logging - Add build_filter_directives() for component-level filtering - Add truncate_prompt() for privacy-safe content preview - Support JSON and pretty log formats via tracing-subscriber - Add 20 structured logging tests (integration + unit) - Update nexus.example.toml with logging configuration examples Closes #117 Closes #118 Closes #119 Closes #120 Closes #121 Closes #122 Closes #123 Closes #124
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #125 +/- ##
==========================================
- Coverage 79.96% 79.04% -0.92%
==========================================
Files 37 40 +3
Lines 1612 1756 +144
==========================================
+ Hits 1289 1388 +99
- Misses 323 368 +45 ☔ View full report in Codecov by Sentry. |
leocamello
added a commit
that referenced
this pull request
Feb 17, 2026
* feat(spec): add F11 structured request logging specification - Add comprehensive spec for structured, queryable request logs - Include correlation IDs for tracking retries and failovers - Define JSON and human-readable log formats - Ensure privacy-safe logging (no message content by default) - Support configurable log levels per component - Align with Constitution principles III, VIII, X - Include complete requirements checklist (14/14 items passed) * feat: implement Structured Request Logging (F11) - Add src/logging/ module (fields.rs, middleware.rs, mod.rs) - Instrument handle_chat_completion with tracing spans - Add request_id (UUID v4) correlation across retries/fallbacks - Extend RoutingResult with route_reason field - Extend LoggingConfig with component_levels and enable_content_logging - Add build_filter_directives() for component-level filtering - Add truncate_prompt() for privacy-safe content preview - Support JSON and pretty log formats via tracing-subscriber - Add 20 structured logging tests (integration + unit) - Update nexus.example.toml with logging configuration examples Closes #117 Closes #118 Closes #119 Closes #120 Closes #121 Closes #122 Closes #123 Closes #124 * doc: add walkthrough and verification for F11 Structured Logging * doc: mark VER-150 complete with PR #125
leocamello
added a commit
that referenced
this pull request
Feb 17, 2026
* feat(spec): add F11 structured request logging specification - Add comprehensive spec for structured, queryable request logs - Include correlation IDs for tracking retries and failovers - Define JSON and human-readable log formats - Ensure privacy-safe logging (no message content by default) - Support configurable log levels per component - Align with Constitution principles III, VIII, X - Include complete requirements checklist (14/14 items passed) * feat: implement Structured Request Logging (F11) - Add src/logging/ module (fields.rs, middleware.rs, mod.rs) - Instrument handle_chat_completion with tracing spans - Add request_id (UUID v4) correlation across retries/fallbacks - Extend RoutingResult with route_reason field - Extend LoggingConfig with component_levels and enable_content_logging - Add build_filter_directives() for component-level filtering - Add truncate_prompt() for privacy-safe content preview - Support JSON and pretty log formats via tracing-subscriber - Add 20 structured logging tests (integration + unit) - Update nexus.example.toml with logging configuration examples Closes #117 Closes #118 Closes #119 Closes #120 Closes #121 Closes #122 Closes #123 Closes #124 * doc: add walkthrough and verification for F11 Structured Logging * doc: mark VER-150 complete with PR #125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements F11: Structured Request Logging — per-request structured logs with correlation IDs, privacy-safe content handling, and component-level filtering.
What's New
Logging Module (
src/logging/)mod.rs— Module exports +build_filter_directives()for EnvFilter constructionmiddleware.rs— UUID v4 request ID generationfields.rs— Token extraction, status extraction, privacy-safe prompt truncationInstrumented Request Handler
#[instrument]macro onhandle_chat_completion()with 15 span fieldsRoute Reason Tracking
RoutingResultgainsroute_reason: Stringfieldhighest_score:backend:0.95,round_robin:index_N,fallback:model:reasonConfiguration
component_levels— per-component log level overridesenable_content_logging— opt-in prompt preview (default: off, with startup warning)tracing-subscriberJSON layerVerification Summary
Spec Artifacts
specs/011-structured-logging/spec.md— 15 functional requirements, 6 user storiesspecs/011-structured-logging/walkthrough.md— Junior-developer-friendly code guideCloses #117
Closes #118
Closes #119
Closes #120
Closes #121
Closes #122
Closes #123
Closes #124