func HTTP(stats map[http.Key]http.RequestStats, dns map[util.Address][]string) []RequestSummary {
	all := make([]RequestSummary, 0, len(stats))
	for k, v := range stats {
		clientAddr := formatIP(k.SrcIPLow, k.SrcIPHigh)
		serverAddr := formatIP(k.DstIPLow, k.DstIPHigh)

		debug := RequestSummary{
			Client: Address{
				IP:   clientAddr.String(),
				Port: k.SrcPort,
			},
			Server: Address{
				IP:   serverAddr.String(),
				Port: k.DstPort,
			},
			DNS:      getDNS(dns, serverAddr),
			Path:     k.Path,
			Method:   k.Method.String(),
			ByStatus: make(map[int]Stats),
		}

		for i, stat := range v {
			if stat.Count == 0 {
				continue
			}

			status := (i + 1) * 100
			debug.ByStatus[status] = Stats{
				Count:              stat.Count,
				FirstLatencySample: stat.FirstLatencySample,
				LatencyP50:         getSketchQuantile(stat.Latencies, 0.5),
			}
		}

		all = append(all, debug)
	}

	return all
}
// HTTP returns a debug-friendly representation of map[http.Key]http.RequestStats
HTTP returns a debug-friendly representation of map[http.Key]http.RequestStats
// HTTP returns a debug - friendly representation of map [ http . Key ] http . RequestStats
func HTTP(stats map[http.Key]http.RequestStats, dns map[util.Address][]string) []RequestSummary {
	all := make([]RequestSummary, 0, len(stats))
	for k, v := range stats {
		clientAddr := formatIP(k.SrcIPLow, k.SrcIPHigh)
		serverAddr := formatIP(k.DstIPLow, k.DstIPHigh)
		debug := RequestSummary{
			Client: Address{
				IP:   clientAddr.String(),
				Port: k.SrcPort,
			},
			Server: Address{
				IP:   serverAddr.String(),
				Port: k.DstPort,
			},
			DNS:      getDNS(dns, serverAddr),
			Path:     k.Path,
			Method:   k.Method.String(),
			ByStatus: make(map[int]Stats),
		}
		for i, stat := range v {
			if stat.Count == 0 {
				continue
			}
			status := (i + 1) * 100
			debug.ByStatus[status] = Stats{
				Count:              stat.Count,
				FirstLatencySample: stat.FirstLatencySample,
				LatencyP50:         getSketchQuantile(stat.Latencies, 0.5),
			}
		}
		all = append(all, debug)
	}
	return all
}
func HTTP ( stats map [ http . Key ] http . RequestStats , dns map [ util . Address ] [ ] string ) [ ] RequestSummary { all := make ( [ ] RequestSummary , 0 , len ( stats ) ) for k , v := range stats { clientAddr := formatIP ( k . SrcIPLow , k . SrcIPHigh ) serverAddr := formatIP ( k . DstIPLow , k . DstIPHigh ) debug := RequestSummary { Client : Address { IP : clientAddr . String ( ) , Port : k . SrcPort , } , Server : Address { IP : serverAddr . String ( ) , Port : k . DstPort , } , DNS : getDNS ( dns , serverAddr ) , Path : k . Path , Method : k . Method . String ( ) , ByStatus : make ( map [ int ] Stats ) , } for i , stat := range v { if stat . Count == 0 { continue } status := ( i + 1 ) * 100 debug . ByStatus [ status ] = Stats { Count : stat . Count , FirstLatencySample : stat . FirstLatencySample , LatencyP50 : getSketchQuantile ( stat . Latencies , 0.5 ) , } } all = append ( all , debug ) } return all }
HTTP returns a debug-friendly representation of map[http.Key]http.RequestStats
HTTP returns a debug - friendly representation of map [ http . Key ] http . RequestStats