       })
     end
 
-    defp emit_stop(result, start_time, prefix, req_env) do
-      duration = System.monotonic_time() - start_time
-
+    defp emit_stop(req_env, duration, prefix, result) do
       case result do
         {:ok, env} ->
           :telemetry.execute(

    defmodule MyClient do
      use Tesla

      plug Tesla.Middleware.Telemetry, prefix: [:my_client]

    end

    :telemetry.attach("my-tesla-telemetry", [:my_client, :tesla, :request, stop], fn event, measurements, meta, config ->
      # Do something with the event
    end)
    ```

    ### Options

    * `:event_prefix` - a list of atoms to prefix to the telemetry event. Defaults to `[]`

    ## Telemetry Events


            reraise e, stacktrace
        end

      duration = System.monotonic_time() - start_time

      emit_stop(env, duration, prefix, result)

      result
    end
