func StatsUserHash(r *UserRecord) error {
	hash, err := services.HashClaims(r.Claims, r.Namespace)
	if err != nil {
		return err
	}
	r.ID = hash
	return nil
}
StatsUserHash is a hash function to hash user records.
package collector
import (
	"encoding/binary"
	"github.com/cespare/xxhash"
	"go.aporeto.io/underwater/core/policy/services"
)
type DefaultCollector struct{}
func NewDefaultCollector() EventCollector {
	return &DefaultCollector{}
}
func (d *DefaultCollector) CollectFlowEvent(record *FlowRecord) {}
func (d *DefaultCollector) CollectContainerEvent(record *ContainerRecord) {}
func (d *DefaultCollector) CollectUserEvent(record *UserRecord) {}
func (d *DefaultCollector) CollectTraceEvent(records []string) {}
func (d *DefaultCollector) CollectPacketEvent(report *PacketReport) {}
func (d *DefaultCollector) CollectCounterEvent(report *CounterReport) {}
func (d *DefaultCollector) CollectDNSRequests(report *DNSRequestReport) {}
func (d *DefaultCollector) CollectPingEvent(report *PingReport) {}
func (d *DefaultCollector) CollectConnectionExceptionReport(report *ConnectionExceptionReport) {}
func StatsFlowHash(r *FlowRecord) (flowhash, contenthash uint64) {
	hash := xxhash.New()
	hash.Write([]byte(r.Source.ID))        
	hash.Write([]byte(r.Destination.ID))   
	hash.Write([]byte(r.Destination.URI))  
	hash.Write([]byte(r.Source.IP))        
	hash.Write([]byte(r.Destination.IP))   
	port := make([]byte, 2)
	binary.BigEndian.PutUint16(port, r.Destination.Port)
	hash.Write(port)  
	flowhash = hash.Sum64()
	hash.Write([]byte(r.Action.String()))          
	hash.Write([]byte(r.ObservedAction.String()))  
	hash.Write([]byte(r.DropReason))               
	hash.Write([]byte(r.PolicyID))                 
	return flowhash, hash.Sum64()
}
func StatsFlowContentHash(r *FlowRecord) (contenthash uint64) {
	_, contenthash = StatsFlowHash(r)
	return contenthash
}