New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accurate Metrics #31

Open
Stebalien opened this Issue Mar 22, 2018 · 0 comments

Comments

1 participant
@Stebalien
Contributor

Stebalien commented Mar 22, 2018

Now that transports do stream multiplexing/encryption, it's impossible to externally track bandwidth metrics.

Proposal: Introduce an (optional) interface that transports can implement to internally (and more accurately) track bandwidth usage. Transports that use the transport upgrader will get this for free but transports like QUIC will have to implement this manually.

type BwStats struct {
	TotalIn, TotalOut int64
	RateIn, RateOut   float64
}

type MeteredConn interface {
	Conn
	BandwidthStats() BandwidthStats
}

If a transport Conn doesn't implement this interface, the Network will fallback on tracking bandwidth usage by summing the bandwidth across all open streams over the connection.

Open question: How will we disable this? Can we just make it fast enough that we don't care (go-flow-metrics is pretty damn fast)? Global flag (yuck!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment