github.com/grafana/pyroscope@v1.18.0/pkg/og/agent/spy/spy.go (about) 1 // Package spy contains an interface (Spy) and functionality to register new spies 2 package spy 3 4 import ( 5 "github.com/grafana/pyroscope/pkg/og/storage/metadata" 6 ) 7 8 type ProfileType string 9 10 const ( 11 ProfileCPU ProfileType = "cpu" 12 ProfileInuseObjects ProfileType = "inuse_objects" 13 ProfileAllocObjects ProfileType = "alloc_objects" 14 ProfileInuseSpace ProfileType = "inuse_space" 15 ProfileAllocSpace ProfileType = "alloc_space" 16 17 Go = "gospy" 18 EBPF = "ebpfspy" 19 Python = "pyspy" 20 Ruby = "rbspy" 21 ) 22 23 func (t ProfileType) IsCumulative() bool { 24 return t == ProfileAllocObjects || t == ProfileAllocSpace 25 } 26 27 func (t ProfileType) Units() metadata.Units { 28 if t == ProfileInuseObjects || t == ProfileAllocObjects { 29 return metadata.ObjectsUnits 30 } 31 if t == ProfileInuseSpace || t == ProfileAllocSpace { 32 return metadata.BytesUnits 33 } 34 35 return metadata.SamplesUnits 36 } 37 38 func (t ProfileType) AggregationType() metadata.AggregationType { 39 if t == ProfileInuseObjects || t == ProfileInuseSpace { 40 return metadata.AverageAggregationType 41 } 42 43 return metadata.SumAggregationType 44 }