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