module Panopticon
Defined in:
panopticon.crConstant Summary
-
HTTPHeader =
"X-Correlation-ID"
-
Header used for passing the correlation ID between services.
-
LogKey =
:correlation_id
-
Key used for storing correlation IDs within a
Log::Context
.
Class Method Summary
-
.attach(context : HTTP::Server::Context) : ID
Receives and upstream ID and applies it to the current execution context.
-
.extract(request : HTTP::Request) : ID | Nil
Extracts a correlation ID from request.
-
.extract(fiber : Fiber) : ID | Nil
Extracts a correlation ID from fiber.
-
.generate_id : ID
Generates a new correlation ID.
-
.id : ID
Provide an ID for the current execution context.
-
.id=(id : ID) : ID
Sets the ID for the current execution context.
-
.id? : ID | Nil
Provides the current correlation ID, or
nil
if tracking is not active. -
.inject(id : ID, fiber : Fiber) : ID
Injects id into fiber.
-
.inject(id : ID, request : HTTP::Request) : ID
Injects id into request.
-
.propagate(to : Fiber | HTTP::Request, from = Fiber.current) : ID | Nil
Copies the ID from an existing execution context to a new
Fiber
or outgoingHTTP::Request
.
Class Method Detail
Receives and upstream ID and applies it to the current execution context.
If an ID does not exist on the received request, a new one is created.
Extracts a correlation ID from request.
Provides the current correlation ID, or nil
if tracking is not active.
Injects id into fiber.
Once injected the ID will continue to be passed to downstream fibers as they are created as well as applied to all outgoing HTTP requests these make.
Copies the ID from an existing execution context to a new Fiber
or
outgoing HTTP::Request
.