@@ -19,7 +19,7 @@ import Foundation
19
19
import WebKit
20
20
21
21
// Make sure the version numbers on the podspec and SplunkRum.swift match
22
- let SplunkRumVersionString = " 0.11.0 "
22
+ let SplunkRumVersionString = " 0.11.1 "
23
23
24
24
/**
25
25
Default maximum size of the disk cache in bytes.
@@ -48,9 +48,11 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024
48
48
networkInstrumentation: Bool = true ,
49
49
enableDiskCache: Bool = false ,
50
50
spanDiskCacheMaxSize: Int64 = DEFAULT_DISK_CACHE_MAX_SIZE_BYTES,
51
+ slowRenderingDetectionEnabled: Bool = true ,
51
52
slowFrameDetectionThresholdMs: Double = 16.7 ,
52
53
frozenFrameDetectionThresholdMs: Double = 700 ,
53
- sessionSamplingRatio: Double = 1.0
54
+ sessionSamplingRatio: Double = 1.0 ,
55
+ spanSchedulingDelay: TimeInterval = 5.0
54
56
) {
55
57
// rejectionFilter not specified to make it possible to call from objc
56
58
self . allowInsecureBeacon = allowInsecureBeacon
@@ -62,6 +64,7 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024
62
64
self . networkInstrumentation = networkInstrumentation
63
65
self . enableDiskCache = enableDiskCache
64
66
self . spanDiskCacheMaxSize = spanDiskCacheMaxSize
67
+ self . slowRenderingDetectionEnabled = slowRenderingDetectionEnabled
65
68
self . slowFrameDetectionThresholdMs = slowFrameDetectionThresholdMs
66
69
self . frozenFrameDetectionThresholdMs = frozenFrameDetectionThresholdMs
67
70
self . sessionSamplingRatio = sessionSamplingRatio
@@ -79,12 +82,14 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024
79
82
self . spanFilter = opts. spanFilter
80
83
self . showVCInstrumentation = opts. showVCInstrumentation
81
84
self . screenNameSpans = opts. screenNameSpans
85
+ self . slowRenderingDetectionEnabled = opts. slowRenderingDetectionEnabled
82
86
self . slowFrameDetectionThresholdMs = opts. slowFrameDetectionThresholdMs
83
87
self . frozenFrameDetectionThresholdMs = opts. frozenFrameDetectionThresholdMs
84
88
self . networkInstrumentation = opts. networkInstrumentation
85
89
self . enableDiskCache = opts. enableDiskCache
86
90
self . spanDiskCacheMaxSize = opts. spanDiskCacheMaxSize
87
91
self . sessionSamplingRatio = opts. sessionSamplingRatio
92
+ self . bspScheduleDelay = opts. bspScheduleDelay
88
93
}
89
94
90
95
/**
@@ -130,6 +135,11 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024
130
135
*/
131
136
@objc public var networkInstrumentation : Bool = true
132
137
138
+ /**
139
+ Enable slow rendering detection. Slow rendering detection generates spans whenever it detects a slow or frozen frame render.
140
+ */
141
+ @objc public var slowRenderingDetectionEnabled : Bool = true
142
+
133
143
/**
134
144
Threshold, in milliseconds, from which to count a rendered frame as slow.
135
145
*/
@@ -156,6 +166,11 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024
156
166
*/
157
167
@objc public var sessionSamplingRatio : Double = 1.0
158
168
169
+ /**
170
+ Set the maximum interval between 2 consecutive span exports
171
+ */
172
+ @objc public var bspScheduleDelay : TimeInterval = 5.0
173
+
159
174
func toAttributeValue( ) -> String {
160
175
var answer = " debug: " + debug. description
161
176
if spanFilter != nil {
@@ -259,7 +274,9 @@ var splunkRumInitializeCalledTime = Date()
259
274
spanDb: spanDb,
260
275
maxFileSizeBytes: options? . spanDiskCacheMaxSize ?? DEFAULT_DISK_CACHE_MAX_SIZE_BYTES)
261
276
let limiting = LimitingExporter ( proxy: diskExporter, spanFilter: options? . spanFilter ?? nil )
262
- tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting) )
277
+ let delay = options? . bspScheduleDelay ?? 5.0
278
+ tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting,
279
+ scheduleDelay: delay) )
263
280
} else {
264
281
DispatchQueue . global ( qos: DispatchQoS . QoSClass. background) . async {
265
282
SpanDb . deleteAtDefaultLocation ( )
@@ -268,7 +285,9 @@ var splunkRumInitializeCalledTime = Date()
268
285
let zipkin = ZipkinTraceExporter ( options: exportOptions)
269
286
let retry = RetryExporter ( proxy: zipkin)
270
287
let limiting = LimitingExporter ( proxy: retry, spanFilter: options? . spanFilter ?? nil )
271
- tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting) )
288
+ let delay = options? . bspScheduleDelay ?? 5.0
289
+ tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting,
290
+ scheduleDelay: delay) )
272
291
}
273
292
274
293
if options? . debug ?? false {
@@ -288,10 +307,12 @@ var splunkRumInitializeCalledTime = Date()
288
307
}
289
308
initializeNetworkTypeMonitoring ( )
290
309
initalizeUIInstrumentation ( )
291
- startSlowFrameDetector (
292
- slowFrameDetectionThresholdMs: options? . slowFrameDetectionThresholdMs,
293
- frozenFrameDetectionThresholdMs: options? . frozenFrameDetectionThresholdMs
294
- )
310
+ if options? . slowRenderingDetectionEnabled ?? true {
311
+ startSlowFrameDetector (
312
+ slowFrameDetectionThresholdMs: options? . slowFrameDetectionThresholdMs,
313
+ frozenFrameDetectionThresholdMs: options? . frozenFrameDetectionThresholdMs
314
+ )
315
+ }
295
316
// not initializeAppLifecycleInstrumentation, done at end of AppStart
296
317
srInit. end ( )
297
318
initialized = true
@@ -351,7 +372,9 @@ var splunkRumInitializeCalledTime = Date()
351
372
spanDb: spanDb,
352
373
maxFileSizeBytes: options. spanDiskCacheMaxSize)
353
374
let limiting = LimitingExporter ( proxy: diskExporter, spanFilter: options. spanFilter)
354
- tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting) )
375
+ let delay = options. bspScheduleDelay
376
+ tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting,
377
+ scheduleDelay: delay) )
355
378
} else {
356
379
DispatchQueue . global ( qos: DispatchQoS . QoSClass. background) . async {
357
380
SpanDb . deleteAtDefaultLocation ( )
@@ -360,7 +383,9 @@ var splunkRumInitializeCalledTime = Date()
360
383
let zipkin = ZipkinTraceExporter ( options: exportOptions)
361
384
let retry = RetryExporter ( proxy: zipkin)
362
385
let limiting = LimitingExporter ( proxy: retry, spanFilter: options. spanFilter)
363
- tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting) )
386
+ let delay = options. bspScheduleDelay
387
+ tracerProvider. addSpanProcessor ( BatchSpanProcessor ( spanExporter: limiting,
388
+ scheduleDelay: delay) )
364
389
}
365
390
366
391
if options. debug {
@@ -378,10 +403,12 @@ var splunkRumInitializeCalledTime = Date()
378
403
}
379
404
initializeNetworkTypeMonitoring ( )
380
405
initalizeUIInstrumentation ( )
381
- startSlowFrameDetector (
382
- slowFrameDetectionThresholdMs: options. slowFrameDetectionThresholdMs,
383
- frozenFrameDetectionThresholdMs: options. frozenFrameDetectionThresholdMs
384
- )
406
+ if options. slowRenderingDetectionEnabled {
407
+ startSlowFrameDetector (
408
+ slowFrameDetectionThresholdMs: options. slowFrameDetectionThresholdMs,
409
+ frozenFrameDetectionThresholdMs: options. frozenFrameDetectionThresholdMs
410
+ )
411
+ }
385
412
// not initializeAppLifecycleInstrumentation, done at end of AppStart
386
413
srInit. end ( )
387
414
initialized = true
0 commit comments