-
Notifications
You must be signed in to change notification settings - Fork 24
Dvernon: MOB-3260/MOB-3261 - New Options #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dvernon-splunk
merged 4 commits into
main
from
dvernon/MOB-3260_MOB-3261_newBuilderOptions
Aug 2, 2023
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a4b1162
MOB-3260 Add an option for slowRenderingDetectionEnabled
dvernon-splunk 5f50070
MOB-3260 adding slowRenderingDetectionEnabled to builder
dvernon-splunk 768a5c7
MOB-3261 create new option for spanScheduleDelay
dvernon-splunk 1a5b131
MOB-3261 renaming bspScheduleDelay and updating description
dvernon-splunk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ import Foundation | |
import WebKit | ||
|
||
// Make sure the version numbers on the podspec and SplunkRum.swift match | ||
let SplunkRumVersionString = "0.11.0" | ||
let SplunkRumVersionString = "0.11.1" | ||
|
||
/** | ||
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 | |
networkInstrumentation: Bool = true, | ||
enableDiskCache: Bool = false, | ||
spanDiskCacheMaxSize: Int64 = DEFAULT_DISK_CACHE_MAX_SIZE_BYTES, | ||
slowRenderingDetectionEnabled: Bool = true, | ||
slowFrameDetectionThresholdMs: Double = 16.7, | ||
frozenFrameDetectionThresholdMs: Double = 700, | ||
sessionSamplingRatio: Double = 1.0 | ||
sessionSamplingRatio: Double = 1.0, | ||
spanSchedulingDelay: TimeInterval = 5.0 | ||
) { | ||
// rejectionFilter not specified to make it possible to call from objc | ||
self.allowInsecureBeacon = allowInsecureBeacon | ||
|
@@ -62,6 +64,7 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024 | |
self.networkInstrumentation = networkInstrumentation | ||
self.enableDiskCache = enableDiskCache | ||
self.spanDiskCacheMaxSize = spanDiskCacheMaxSize | ||
self.slowRenderingDetectionEnabled = slowRenderingDetectionEnabled | ||
self.slowFrameDetectionThresholdMs = slowFrameDetectionThresholdMs | ||
self.frozenFrameDetectionThresholdMs = frozenFrameDetectionThresholdMs | ||
self.sessionSamplingRatio = sessionSamplingRatio | ||
|
@@ -79,12 +82,14 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024 | |
self.spanFilter = opts.spanFilter | ||
self.showVCInstrumentation = opts.showVCInstrumentation | ||
self.screenNameSpans = opts.screenNameSpans | ||
self.slowRenderingDetectionEnabled = opts.slowRenderingDetectionEnabled | ||
self.slowFrameDetectionThresholdMs = opts.slowFrameDetectionThresholdMs | ||
self.frozenFrameDetectionThresholdMs = opts.frozenFrameDetectionThresholdMs | ||
self.networkInstrumentation = opts.networkInstrumentation | ||
self.enableDiskCache = opts.enableDiskCache | ||
self.spanDiskCacheMaxSize = opts.spanDiskCacheMaxSize | ||
self.sessionSamplingRatio = opts.sessionSamplingRatio | ||
self.spanSchedulingDelay = opts.spanSchedulingDelay | ||
} | ||
|
||
/** | ||
|
@@ -130,6 +135,11 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024 | |
*/ | ||
@objc public var networkInstrumentation: Bool = true | ||
|
||
/** | ||
Enable slow rendering detection. Slow rendering detection generates spans whenever it detects a slow or frozen frame render. | ||
*/ | ||
@objc public var slowRenderingDetectionEnabled: Bool = true | ||
|
||
/** | ||
Threshold, in milliseconds, from which to count a rendered frame as slow. | ||
*/ | ||
|
@@ -156,6 +166,11 @@ public let DEFAULT_DISK_CACHE_MAX_SIZE_BYTES: Int64 = 25 * 1024 * 1024 | |
*/ | ||
@objc public var sessionSamplingRatio: Double = 1.0 | ||
|
||
/** | ||
Set the time interval between batch span sampling in seconds | ||
*/ | ||
@objc public var spanSchedulingDelay: TimeInterval = 5.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few alternative naming ideas: |
||
|
||
func toAttributeValue() -> String { | ||
var answer = "debug: "+debug.description | ||
if spanFilter != nil { | ||
|
@@ -259,7 +274,9 @@ var splunkRumInitializeCalledTime = Date() | |
spanDb: spanDb, | ||
maxFileSizeBytes: options?.spanDiskCacheMaxSize ?? DEFAULT_DISK_CACHE_MAX_SIZE_BYTES) | ||
let limiting = LimitingExporter(proxy: diskExporter, spanFilter: options?.spanFilter ?? nil) | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting)) | ||
let delay = options?.spanSchedulingDelay ?? 5.0 | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting, | ||
scheduleDelay: delay)) | ||
} else { | ||
DispatchQueue.global(qos: DispatchQoS.QoSClass.background).async { | ||
SpanDb.deleteAtDefaultLocation() | ||
|
@@ -268,7 +285,9 @@ var splunkRumInitializeCalledTime = Date() | |
let zipkin = ZipkinTraceExporter(options: exportOptions) | ||
let retry = RetryExporter(proxy: zipkin) | ||
let limiting = LimitingExporter(proxy: retry, spanFilter: options?.spanFilter ?? nil) | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting)) | ||
let delay = options?.spanSchedulingDelay ?? 5.0 | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting, | ||
scheduleDelay: delay)) | ||
} | ||
|
||
if options?.debug ?? false { | ||
|
@@ -288,10 +307,12 @@ var splunkRumInitializeCalledTime = Date() | |
} | ||
initializeNetworkTypeMonitoring() | ||
initalizeUIInstrumentation() | ||
startSlowFrameDetector( | ||
slowFrameDetectionThresholdMs: options?.slowFrameDetectionThresholdMs, | ||
frozenFrameDetectionThresholdMs: options?.frozenFrameDetectionThresholdMs | ||
) | ||
if options?.slowRenderingDetectionEnabled ?? true { | ||
startSlowFrameDetector( | ||
slowFrameDetectionThresholdMs: options?.slowFrameDetectionThresholdMs, | ||
frozenFrameDetectionThresholdMs: options?.frozenFrameDetectionThresholdMs | ||
) | ||
} | ||
// not initializeAppLifecycleInstrumentation, done at end of AppStart | ||
srInit.end() | ||
initialized = true | ||
|
@@ -351,7 +372,9 @@ var splunkRumInitializeCalledTime = Date() | |
spanDb: spanDb, | ||
maxFileSizeBytes: options.spanDiskCacheMaxSize) | ||
let limiting = LimitingExporter(proxy: diskExporter, spanFilter: options.spanFilter) | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting)) | ||
let delay = options.spanSchedulingDelay | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting, | ||
scheduleDelay: delay)) | ||
} else { | ||
DispatchQueue.global(qos: DispatchQoS.QoSClass.background).async { | ||
SpanDb.deleteAtDefaultLocation() | ||
|
@@ -360,7 +383,9 @@ var splunkRumInitializeCalledTime = Date() | |
let zipkin = ZipkinTraceExporter(options: exportOptions) | ||
let retry = RetryExporter(proxy: zipkin) | ||
let limiting = LimitingExporter(proxy: retry, spanFilter: options.spanFilter) | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting)) | ||
let delay = options.spanSchedulingDelay | ||
tracerProvider.addSpanProcessor(BatchSpanProcessor(spanExporter: limiting, | ||
scheduleDelay: delay)) | ||
} | ||
|
||
if options.debug { | ||
|
@@ -378,10 +403,12 @@ var splunkRumInitializeCalledTime = Date() | |
} | ||
initializeNetworkTypeMonitoring() | ||
initalizeUIInstrumentation() | ||
startSlowFrameDetector( | ||
slowFrameDetectionThresholdMs: options.slowFrameDetectionThresholdMs, | ||
frozenFrameDetectionThresholdMs: options.frozenFrameDetectionThresholdMs | ||
) | ||
if options.slowRenderingDetectionEnabled { | ||
startSlowFrameDetector( | ||
slowFrameDetectionThresholdMs: options.slowFrameDetectionThresholdMs, | ||
frozenFrameDetectionThresholdMs: options.frozenFrameDetectionThresholdMs | ||
) | ||
} | ||
// not initializeAppLifecycleInstrumentation, done at end of AppStart | ||
srInit.end() | ||
initialized = true | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a more apt description would be "maximum interval between 2 consecutive span exports"