mint icon indicating copy to clipboard operation
mint copied to clipboard

Tracing

Open michaelst opened this issue 5 months ago • 17 comments

I'm looking to implement http request tracing in elixir (inspired by this in GO: https://pkg.go.dev/net/http/httptrace).

This is not ready but before investing more time in this I wanted to see what the thoughts are on this general direction for implementation and if this is something that would be welcome in mint. I was thinking the callback fun was the most flexible as others could hookup telemetry with that or send messages to a process where you need to tie the timings back to a specfic request, for example

{:ok, conn} =
  Mint.HTTP.connect(:https, "example.com", 443,
    log: true,
    trace_fun: fn event ->
      send(self, {:trace, event, System.monotonic_time()})
      :ok
    end
  )

However, if there are other alternatives I'm happy to shift direction as well. Mainly wanted to start the conversation for this.

michaelst avatar Sep 01 '24 22:09 michaelst