Skip to main content

WithRequestID

Gets a new context with RequestID set.

def WithRequestID(
ctx: context.Context,
requestID: string
) - > context.Context

Gets a new context with RequestID set. This function is used to propagate a request identifier through the context for tracing or logging purposes.

Parameters​

NameTypeDescription
ctxcontext.ContextThe parent context to which the request ID will be added.
requestIDstringThe unique identifier for the request to be associated with the context.

Returns​

TypeDescription
context.ContextA new context with the provided request ID associated with it.