-1

The go official library provides net/http/client which internally implements a thread-safe connection pool. I want to query the current connection pool status: how many connections, how many are idle, etc. during the program running process

1 Answers1

-1

Although this information is not exposed by the underlying structure, similar functionality can be achieved using external dependencies such as https://github.com/mwitkow/go-conntrack

For example, Prometheus code contains the following:

// Monitor outgoing connections on default transport with conntrack.
http.DefaultTransport.(*http.Transport).DialContext = conntrack.NewDialContextFunc(
        conntrack.DialWithTracing(),
)
Oleg
  • 662
  • 6
  • 10