-
Notifications
You must be signed in to change notification settings - Fork 8
/
fsdetaillevel.go
68 lines (56 loc) · 1.77 KB
/
fsdetaillevel.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package trace2receiver
import (
"errors"
)
// FilterDetailLevel describes the amount of detail in the output
// OTLP that we will generate for a Git command.
type FilterDetailLevel int
const (
DetailLevelUnset FilterDetailLevel = iota
DetailLevelDrop
DetailLevelSummary
DetailLevelProcess
DetailLevelVerbose
)
// All detail level names have leading "dl:" to help avoid
// cycles when resolving a custom ruleset name.
const (
DetailLevelDropName string = "dl:drop"
DetailLevelSummaryName string = "dl:summary"
DetailLevelProcessName string = "dl:process"
DetailLevelVerboseName string = "dl:verbose"
DetailLevelDefaultName string = DetailLevelSummaryName
)
// Convert a detail level name into a detail level id.
func getDetailLevel(dl_name string) (FilterDetailLevel, error) {
switch dl_name {
case DetailLevelDropName:
return DetailLevelDrop, nil
case DetailLevelSummaryName:
return DetailLevelSummary, nil
case DetailLevelProcessName:
return DetailLevelProcess, nil
case DetailLevelVerboseName:
return DetailLevelVerbose, nil
default:
return DetailLevelUnset, errors.New("invalid detail level")
}
}
func WantRegionAndThreadSpans(dl FilterDetailLevel) bool {
return dl == DetailLevelVerbose
}
func WantChildSpans(dl FilterDetailLevel) bool {
return dl == DetailLevelProcess || dl == DetailLevelVerbose
}
func WantProcessAncestry(dl FilterDetailLevel) bool {
return dl == DetailLevelProcess || dl == DetailLevelVerbose
}
func WantProcessAliases(dl FilterDetailLevel) bool {
return dl == DetailLevelProcess || dl == DetailLevelVerbose
}
func WantProcessTimersCountersAndData(dl FilterDetailLevel) bool {
return dl == DetailLevelProcess || dl == DetailLevelVerbose
}
func WantMainThreadTimersAndCounters(dl FilterDetailLevel) bool {
return WantRegionAndThreadSpans(dl)
}