Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RequestID to http handler and store as a context value #8526

Open
mkcp opened this issue Aug 17, 2020 · 1 comment
Open

Add RequestID to http handler and store as a context value #8526

mkcp opened this issue Aug 17, 2020 · 1 comment
Labels
theme/operator-usability Replaces UX. Anything related to making things easier for the practitioner theme/telemetry Anything related to telemetry or observability type/enhancement Proposed improvement or new feature

Comments

@mkcp
Copy link
Contributor

mkcp commented Aug 17, 2020

Feature Description

RequestIDs are a common industry pattern for uniquely identifying a request throughout its lifecycle. In HTTP systems, typically they are generated by the server accepting the initial request and propagated via the header X-Request-ID. I'll call this behavior generate-or-propagate, where you take an ID if it's given or make a new one.

Once we've generated or accepted an X-Request-ID, we can store it as a value on the req.Context to be passed through to whatever endpoint are handles the request.

It's OK for these requestIDs to end at the RPC layer for a first iteration. Down the line we can see about adding generate-or-propagate behavior to RPCs and adding RequestIDs to our RPC structs.

Use Case(s)

This is primarily a debugging-focused feature. RequestIDs give us a mechanism to uniquely identify a request in logged events and more deeply inspect Consul's behavior. The main use case is correlating Consul's logs to a specific HTTP response. Also, if users have instrumentation set up to propagate their own requestIDs, then Consul can participate.

Down the line, when we implement RPC-level propagation, we'd be able to view a set of logs across various multiple Consul processes by selecting the RequestID. The ID can also compose with other debugging features - if we were to store the RequestID in tracing spans we'd be able to correlate a set of traces with the logs of the request(s) involved.

Out of scope

When this issue is completed, we should create an issue for generating-or-propagating RequestIDs through our RPC layer.

@mkcp mkcp added type/enhancement Proposed improvement or new feature theme/operator-usability Replaces UX. Anything related to making things easier for the practitioner theme/telemetry Anything related to telemetry or observability labels Aug 17, 2020
@banks
Copy link
Member

banks commented Aug 19, 2020

Down the line we can see about adding generate-or-propagate behavior to RPCs and adding RequestIDs to our RPC structs

Just a quick note to say that our long term plan is to move to gRPC internally instead of msgpackRPC we don't have a tight deadline on that though as it's background work with several dependencies. Depending on timing it may end up being easier if that happens first since gRPC can just use HTTP2 headers to propagate this rather than needing invasive changes to all our structs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/operator-usability Replaces UX. Anything related to making things easier for the practitioner theme/telemetry Anything related to telemetry or observability type/enhancement Proposed improvement or new feature
Projects
None yet
Development

No branches or pull requests

2 participants