Repository navigation
feat(log): json/logfmt/text output with request-scoped labels - #21
Open
kylecrawshaw wants to merge 1 commit into
Open
kylecrawshaw wants to merge 1 commit into
kylecrawshaw wants to merge 1 commit into
Conversation
…abels Operators can pick a collector-friendly encoding from [log], and request-path lines carry request_id (and W3C traceparent ids) without repeating those fields at each call site. Co-authored-by: Cursor <cursoragent@cursor.com>
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
[log]config section (level,format, optionallabels) plusANTEROOM_LOG_LEVEL/ANTEROOM_LOG_FORMAToverrides. Default stays text at info;-vstill forces debug.json,logfmt, ortextwith no new dependencies.request_id(honoring inboundX-Request-ID/X-Correlation-ID, otherwise generated) and W3Ctraceparenttrace_id/span_idthrough context on request-path log lines, and forwardX-Request-IDupstream so application logs join.Test plan
go test -race ./...(unit coverage for config, handlers, request-ID forwarding, and hit-line context)anteroom -vstill logs onehitline per request, now includingrequest_id[log] format = "json"(orANTEROOM_LOG_FORMAT=json) produces JSON;logfmtusests=and lowercaselevelX-Request-ID: keep-meand a W3Ctraceparent; logs carry those ids and the upstream seesX-Request-ID: keep-me[log.labels] service = "anteroom"appears on every line, including startup