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.



client =
  |> OpentelemetryReq.attach()
  |> Req.Request.merge_options(
    base_url: "http://localhost:4000",
    propagate_trace_ctx: true

|> Req.get(
  url: "/api/users/:user_id",
  path_params: [user_id: user_id]


Request Options

  • :span_name - String.t() if provided, overrides the span name. Defaults to nil.
  • :no_path_params - boolean() when set to true no path params are expected for the request. Defaults to false
  • :propagate_trace_ctx - boolean() when set to true, trace headers will be propagated. Defaults to false

Link to this section Summary

Link to this section Functions

Link to this function

attach(request, options \\ [])

View Source