@@ -38,6 +38,9 @@ type LambdaExtensionConfig struct {
38
38
EnhanceJsonLogs bool
39
39
EnableSpanDrops bool
40
40
KmsCacheSeconds int64
41
+ TelemetryTimeoutMs int
42
+ TelemetryMaxBytes int64
43
+ TelemetryMaxItems int
41
44
}
42
45
43
46
var defaultLogTypes = []string {"platform" , "function" }
@@ -82,6 +85,22 @@ func (cfg *LambdaExtensionConfig) setDefaults() {
82
85
enhanceJsonLogs := os .Getenv ("SUMO_ENHANCE_JSON_LOGS" )
83
86
enableSpanDrops := os .Getenv ("SUMO_SPAN_DROP" )
84
87
kmsCacheSeconds := os .Getenv ("KMS_CACHE_SECONDS" )
88
+ telemetryTimeoutMs := os .Getenv ("TELEMETRY_TIMEOUT_MS" )
89
+ telemetryMaxBytes := os .Getenv ("TELEMETRY_MAX_BYTES" )
90
+ telemetryMaxItems := os .Getenv ("TELEMETRY_MAX_ITEMS" )
91
+
92
+ if telemetryTimeoutMs == "" {
93
+ cfg .TelemetryTimeoutMs = 1000
94
+ }
95
+
96
+ if telemetryMaxBytes == "" {
97
+ cfg .TelemetryMaxBytes = 262144
98
+ }
99
+
100
+ if telemetryMaxItems == "" {
101
+ cfg .TelemetryMaxItems = 10000
102
+ }
103
+
85
104
86
105
if numRetry == "" {
87
106
cfg .NumRetry = 3
@@ -141,6 +160,9 @@ func (cfg *LambdaExtensionConfig) validateConfig() error {
141
160
enhanceJsonLogs := os .Getenv ("SUMO_ENHANCE_JSON_LOGS" )
142
161
enableSpanDrops := os .Getenv ("SUMO_SPAN_DROP" )
143
162
kmsCacheSeconds := os .Getenv ("KMS_CACHE_SECONDS" )
163
+ telemetryTimeoutMs := os .Getenv ("TELEMETRY_TIMEOUT_MS" )
164
+ telemetryMaxBytes := os .Getenv ("TELEMETRY_MAX_BYTES" )
165
+ telemetryMaxItems := os .Getenv ("TELEMETRY_MAX_ITEMS" )
144
166
145
167
var allErrors []string
146
168
var err error
@@ -239,6 +261,38 @@ func (cfg *LambdaExtensionConfig) validateConfig() error {
239
261
}
240
262
}
241
263
264
+ if telemetryTimeoutMs != "" {
265
+ telemetryTimeoutMs , err := strconv .ParseInt (telemetryTimeoutMs , 10 , 32 )
266
+ if err != nil {
267
+ allErrors = append (allErrors , fmt .Sprintf ("Unable to parse TELEMETRY_TIMEOUT_MS: %v" , err ))
268
+ } else {
269
+ cfg .TelemetryTimeoutMs = int (telemetryTimeoutMs )
270
+ }
271
+ cfg .TelemetryTimeoutMs = max (cfg .TelemetryTimeoutMs , 25 )
272
+ cfg .TelemetryTimeoutMs = min (cfg .TelemetryTimeoutMs , 30000 )
273
+ }
274
+
275
+ if telemetryMaxBytes != "" {
276
+ cfg .TelemetryMaxBytes , err = strconv .ParseInt (telemetryMaxBytes , 10 , 64 )
277
+ if err != nil {
278
+ allErrors = append (allErrors , fmt .Sprintf ("Unable to parse TELEMETRY_MAX_BYTES: %v" , err ))
279
+ }
280
+ cfg .TelemetryMaxBytes = max (cfg .TelemetryMaxBytes , 262144 )
281
+ cfg .TelemetryMaxBytes = min (cfg .TelemetryMaxBytes , 1048576 )
282
+ }
283
+
284
+ if telemetryMaxItems != "" {
285
+ telemetryMaxItems , err := strconv .ParseInt (telemetryMaxItems , 10 , 32 )
286
+ if err != nil {
287
+ allErrors = append (allErrors , fmt .Sprintf ("Unable to parse TELEMETRY_MAX_ITEMS: %v" , err ))
288
+ } else {
289
+ cfg .TelemetryMaxItems = int (telemetryMaxItems )
290
+ }
291
+ cfg .TelemetryMaxItems = max (cfg .TelemetryMaxItems , 1000 )
292
+ cfg .TelemetryMaxItems = min (cfg .TelemetryMaxItems , 10000 )
293
+ }
294
+
295
+
242
296
// test valid log format type
243
297
for _ , logType := range cfg .LogTypes {
244
298
if ! utils .StringInSlice (strings .TrimSpace (logType ), validLogTypes ) {
0 commit comments