View Source OpentelemetryReq (Opentelemetry Req v0.1.2)
Wraps the request in an opentelemetry span. Span names must be paramaterized, so the
req_path_params
module and step should be registered before this step. This step is
expected by default and an error will be raised if the path params option is
not set for the request.
Given the steps pipeline can be halted to skip further steps from running, it is important to append request and response steps after this step to ensure execution. Spans are not created until the request is completed or errored.
example
Example
client =
Req.new()
|> OpentelemetryReq.attach()
|> Req.Request.merge_options(
base_url: "http://localhost:4000",
propagate_trace_ctx: true
)
client
|> Req.get(
url: "/api/users/:user_id",
path_params: [user_id: user_id]
)
request-options
Request Options
:span_name
-String.t()
if provided, overrides the span name. Defaults tonil
.:no_path_params
-boolean()
when set totrue
no path params are expected for the request. Defaults tofalse
:propagate_trace_ctx
-boolean()
when set totrue
, trace headers will be propagated. Defaults tofalse