Skip to content

Commit ef81220

Browse files
committed
adding caller to error metrics
1 parent eb2860a commit ef81220

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

core/src/main/java/com/segment/analytics/kotlin/core/Analytics.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ open class Analytics protected constructor(
9898
Telemetry.INVOKE_ERROR_METRIC, t.stackTraceToString()) {
9999
it["error"] = t.toString()
100100
it["message"] = "Exception in Analytics Scope"
101+
it["caller"] = t.stackTrace[0].toString()
101102
}
102103
}
103104
override val analyticsScope = CoroutineScope(SupervisorJob() + exceptionHandler)

core/src/main/java/com/segment/analytics/kotlin/core/HTTPClient.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class HTTPClient(
3939
it["error"] = e.toString()
4040
it["writekey"] = writeKey
4141
it["message"] = "Malformed url"
42+
it["caller"] = e.stackTrace[0].toString()
4243
}
4344
throw error
4445
}

core/src/main/java/com/segment/analytics/kotlin/core/Settings.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ internal fun Analytics.fetchSettings(
124124
it["error"] = ex.toString()
125125
it["writekey"] = writeKey
126126
it["message"] = "Error retrieving settings"
127+
it["caller"] = ex.stackTrace[0].toString()
127128
}
128129
configuration.defaultSettings
129130
}

core/src/main/java/com/segment/analytics/kotlin/core/platform/Mediator.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ internal class Mediator(internal var plugins: CopyOnWriteArrayList<Plugin> = Cop
6262
it["plugin"] = "${plugin.type}-${plugin.javaClass}"
6363
}
6464
it["writekey"] = plugin.analytics.configuration.writeKey
65-
it["message"] ="Exception executing plugin"
65+
it["message"] = "Exception executing plugin"
66+
it["caller"] = t.stackTrace[0].toString()
6667
}
6768
}
6869
}
@@ -87,6 +88,7 @@ internal class Mediator(internal var plugins: CopyOnWriteArrayList<Plugin> = Cop
8788
}
8889
it["writekey"] = plugin.analytics.configuration.writeKey
8990
it["message"] = "Exception executing plugin"
91+
it["caller"] = t.stackTrace[0].toString()
9092
}
9193
}
9294
}

0 commit comments

Comments
 (0)