-
Notifications
You must be signed in to change notification settings - Fork 530
/
Copy pathconfig.go
69 lines (53 loc) · 2.39 KB
/
config.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
69
package servicegraphs
import (
"flag"
"time"
"github.com/grafana/tempo/modules/generator/registry"
"github.com/prometheus/client_golang/prometheus"
)
const (
Name = "service-graphs"
)
type Config struct {
// Wait is the value to wait for an edge to be completed
Wait time.Duration `yaml:"wait"`
// MaxItems is the amount of edges that will be stored in the storeMap
MaxItems int `yaml:"max_items"`
// Workers is the amount of workers that will be used to process the edges
Workers int `yaml:"workers"`
// Buckets for latency histogram in seconds.
HistogramBuckets []float64 `yaml:"histogram_buckets"`
// The histogram mode to select.
HistogramOverride registry.HistogramMode `yaml:"-"`
// Additional dimensions (labels) to be added to the metric along with the default ones.
// If client and server spans have the same attribute and EnableClientServerPrefix is not enabled,
// behaviour is undetermined (either value could get used)
Dimensions []string `yaml:"dimensions"`
// If enabled, additional dimensions (labels) will be prefixed with either
// "client_" or "server_" depending on the span kind. Up to two labels will be added
// per dimension.
EnableClientServerPrefix bool `yaml:"enable_client_server_prefix"`
// If enabled another histogram will be produced for interactions over messaging systems middlewares
EnableMessagingSystemLatencyHistogram bool `yaml:"enable_messaging_system_latency_histogram"`
// PeerAttributes are attributes that will be used to create a peer edge
// Attributes are searched in the order they are provided
PeerAttributes []string `yaml:"peer_attributes"`
// If enabled attribute value will be used for metric calculation
SpanMultiplierKey string `yaml:"span_multiplier_key"`
// EnableVirtualNodeLabel enables additional labels for uninstrumented services
EnableVirtualNodeLabel bool `yaml:"enable_virtual_node_label"`
}
func (cfg *Config) RegisterFlagsAndApplyDefaults(string, *flag.FlagSet) {
cfg.Wait = 10 * time.Second
cfg.MaxItems = 10_000
cfg.Workers = 10
// TODO: Revisit this default value.
cfg.HistogramBuckets = prometheus.ExponentialBuckets(0.1, 2, 8)
cfg.HistogramOverride = registry.HistogramModeClassic
peerAttr := make([]string, 0, len(defaultPeerAttributes))
for _, attr := range defaultPeerAttributes {
peerAttr = append(peerAttr, string(attr))
}
cfg.PeerAttributes = peerAttr
cfg.EnableMessagingSystemLatencyHistogram = false
}