Skip to content

net: I would like Dialer.Dial to provide the time it took to do DNS lookups and TCP Connect #12476

Closed
@sajal

Description

@sajal

When using Dialer.Dial package, I would like to know how long did the DNS queries take to resolve. The reason to know this is because I am building a network debugging tool - TurboBytes Pulse.

My ugly hacky implementation : https://github.com/turbobytes/pulse/blob/master/misc/patch_dialtimer.go

I place the file above inside net package and it provides me the DNS and Connect timings, but it is not nice to ask users of my tool to patch their Go distribution.

I would be nice if Go would provide an alternate Dial method which provides timing data for various steps, as well as some debugging information about DualStack handling, failovers, etc.

Perhaps change Dial's signature to :-

type DialDebugInfo struct {
     DNSTime         time.Duration
     ConnectTime   time.Duration
     //Other fields ...
}

func (d *Dialer) Dial(network, address string, debug *DialDebugInfo) (Conn, error)

If debug is non-nill, then populate it with all sorts of useful information.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions