-
Notifications
You must be signed in to change notification settings - Fork 2
/
defaults.go
114 lines (110 loc) · 4.12 KB
/
defaults.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package config // import "github.com/Traceableai/goagent/config"
import (
traceableconfig "github.com/Traceableai/agent-config/gen/go/v1"
hyperconfig "github.com/hypertrace/agent-config/gen/go/v1"
"google.golang.org/protobuf/types/known/wrapperspb"
)
var defaultRemoteConfig = &traceableconfig.RemoteConfig{
Enabled: traceableconfig.Bool(true),
Endpoint: traceableconfig.String("localhost:5441"),
PollPeriodSeconds: traceableconfig.Int32(30),
CertFile: traceableconfig.String(""),
GrpcMaxCallRecvMsgSize: traceableconfig.Int32(32 * 1024 * 1024),
UseSecureConnection: traceableconfig.Bool(false),
}
// defaultConfig holds the default config values for agent.
var defaultConfig = &AgentConfig{
// TODO update ht agent config so that we can refer that directly
Tracing: &hyperconfig.AgentConfig{
Enabled: hyperconfig.Bool(true),
PropagationFormats: []hyperconfig.PropagationFormat{hyperconfig.PropagationFormat_TRACECONTEXT},
DataCapture: &hyperconfig.DataCapture{
HttpHeaders: &hyperconfig.Message{
Request: hyperconfig.Bool(true),
Response: hyperconfig.Bool(true),
},
HttpBody: &hyperconfig.Message{
Request: hyperconfig.Bool(true),
Response: hyperconfig.Bool(true),
},
RpcMetadata: &hyperconfig.Message{
Request: hyperconfig.Bool(true),
Response: hyperconfig.Bool(true),
},
RpcBody: &hyperconfig.Message{
Request: hyperconfig.Bool(true),
Response: hyperconfig.Bool(true),
},
BodyMaxSizeBytes: hyperconfig.Int32(131072),
BodyMaxProcessingSizeBytes: hyperconfig.Int32(1048576),
AllowedContentTypes: []*wrapperspb.StringValue{
wrapperspb.String("json"),
wrapperspb.String("x-www-form-urlencoded"),
wrapperspb.String("xml"),
},
},
Reporting: &hyperconfig.Reporting{
Endpoint: hyperconfig.String("localhost:4317"),
Secure: hyperconfig.Bool(false),
TraceReporterType: hyperconfig.TraceReporterType_OTLP,
CertFile: hyperconfig.String(""),
EnableGrpcLoadbalancing: hyperconfig.Bool(true),
},
Goagent: &hyperconfig.GoAgent{
UseCustomBsp: hyperconfig.Bool(true),
},
},
TraceableConfig: &traceableconfig.AgentConfig{
Environment: traceableconfig.String(""),
BlockingConfig: &traceableconfig.BlockingConfig{
Enabled: traceableconfig.Bool(true),
Modsecurity: &traceableconfig.ModsecurityConfig{
Enabled: traceableconfig.Bool(true),
},
EvaluateBody: traceableconfig.Bool(true),
RegionBlocking: &traceableconfig.RegionBlockingConfig{
Enabled: traceableconfig.Bool(true),
},
SkipInternalRequest: traceableconfig.Bool(true),
RemoteConfig: defaultRemoteConfig,
ResponseStatusCode: traceableconfig.Int32(403),
ResponseMessage: traceableconfig.String("Access Forbidden"),
MaxRecursionDepth: traceableconfig.Int32(20),
},
RemoteConfig: defaultRemoteConfig,
Sampling: &traceableconfig.SamplingConfig{
Enabled: traceableconfig.Bool(true),
DefaultRateLimitConfig: &traceableconfig.RateLimitConfig{
Enabled: traceableconfig.Bool(false),
},
},
Logging: &traceableconfig.LogConfig{
LogMode: traceableconfig.LogMode_LOG_MODE_STDOUT,
LogLevel: traceableconfig.LogLevel_LOG_LEVEL_INFO,
LogFile: &traceableconfig.LogFileConfig{
MaxFiles: traceableconfig.Int32(3),
MaxFileSize: traceableconfig.Int32(10485760),
FilePath: traceableconfig.String("/var/traceable/log/libtraceable-goagent.log"),
},
},
MetricsConfig: &traceableconfig.MetricsConfig{
Enabled: traceableconfig.Bool(false),
EndpointConfig: &traceableconfig.EndpointMetricsConfig{
Enabled: traceableconfig.Bool(false),
// same values from libtraceable defaults
MaxEndpoints: traceableconfig.Int32(5000),
Logging: &traceableconfig.MetricsLogConfig{
Enabled: traceableconfig.Bool(true),
Frequency: traceableconfig.String("30m"),
},
},
Logging: &traceableconfig.MetricsLogConfig{
Enabled: traceableconfig.Bool(true),
Frequency: traceableconfig.String("30m"),
},
},
},
}
func GetDefaultRemoteConfig() *traceableconfig.RemoteConfig {
return defaultRemoteConfig
}