Skip to content

Commit

Permalink
Cleaning up code and removing noisy caller tag
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelGHSeg committed Nov 24, 2024
1 parent cc47b9a commit f8a29a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 8 additions & 10 deletions Sources/Segment/Errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,11 @@ extension Analytics {
if fatal {
exceptionFailure("A critical error occurred: \(translatedError)")
}
Telemetry.shared.error(metric: Telemetry.INVOKE_ERROR_METRIC, log: Thread.callStackSymbols.joined(separator: "\n")) {
(_ it: inout [String: String]) in
it["error"] = "\(translatedError)"
it["writekey"] = configuration.values.writeKey
it["caller"] = Thread.callStackSymbols[3]
}
Telemetry.shared.error(metric: Telemetry.INVOKE_ERROR_METRIC, log: Thread.callStackSymbols.joined(separator: "\n")) {
(_ it: inout [String: String]) in
it["error"] = "\(translatedError)"
it["writekey"] = configuration.values.writeKey
}
}

static public func reportInternalError(_ error: Error, fatal: Bool = false) {
Expand All @@ -90,9 +89,8 @@ extension Analytics {
exceptionFailure("A critical error occurred: \(translatedError)")
}
Telemetry.shared.error(metric: Telemetry.INVOKE_ERROR_METRIC, log: Thread.callStackSymbols.joined(separator: "\n")) {
(_ it: inout [String: String]) in
it["error"] = "\(translatedError)"
it["caller"] = Thread.callStackSymbols[3]
}
(_ it: inout [String: String]) in
it["error"] = "\(translatedError)"
}
}
}
2 changes: 0 additions & 2 deletions Sources/Segment/Utilities/Telemetry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public class Telemetry: Subscriber {
internal var queue = [RemoteMetric]()
private var queueBytes = 0
private var queueSizeExceeded = false
private var seenErrors = [String: Int]()
internal var started = false
private var rateLimitEndTime: TimeInterval = 0
internal var flushFirstError = true
Expand Down Expand Up @@ -118,7 +117,6 @@ public class Telemetry: Subscriber {
func reset() {
telemetryTimer?.suspend()
resetQueue()
seenErrors.removeAll()
started = false
rateLimitEndTime = 0
}
Expand Down

0 comments on commit f8a29a3

Please sign in to comment.