-
Notifications
You must be signed in to change notification settings - Fork 61
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
RUMM-924 Introduce the new InternalLogger#metric API #1581
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,7 +113,7 @@ internal class TelemetryEventHandler( | |
|
||
val eventIdentity = event.identity | ||
|
||
if (seenInCurrentSession.contains(eventIdentity)) { | ||
if (!event.isMetric && seenInCurrentSession.contains(eventIdentity)) { | ||
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. do we have a risk of sending too much metrics by disabling this check and thus adding a lot of pressure on the storage and also on the Datadog servers? 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. I was following what was done in iOS here. I guess the risk was assessed already there, in the end we are going to have an extra sampler in the |
||
sdkCore.internalLogger.log( | ||
InternalLogger.Level.INFO, | ||
InternalLogger.Target.MAINTAINER, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1124,6 +1124,69 @@ internal class RumFeatureTest { | |
verifyNoInteractions(mockInternalLogger) | ||
} | ||
|
||
@Test | ||
fun `𝕄 handle metric event 𝕎 onReceive()`( | ||
@StringForgery fakeMessage: String, | ||
forge: Forge | ||
) { | ||
// Given | ||
val fakeAdditionalProperties = forge.exhaustiveAttributes() | ||
testedFeature.onInitialize(appContext.mockInstance) | ||
val event = mapOf( | ||
"type" to RumFeature.MOBILE_METRIC_MESSAGE_TYPE, | ||
"message" to fakeMessage, | ||
"additionalProperties" to fakeAdditionalProperties | ||
) | ||
|
||
// When | ||
testedFeature.onReceive(event) | ||
|
||
// Then | ||
verify(mockRumMonitor).sendMetricEvent(fakeMessage, fakeAdditionalProperties) | ||
verifyNoMoreInteractions(mockRumMonitor) | ||
verifyNoInteractions(mockInternalLogger) | ||
} | ||
|
||
@Test | ||
fun `𝕄 handle metric event 𝕎 onReceive(){no additionalProperties}`( | ||
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. probably test with missing message is missing |
||
@StringForgery fakeMessage: String | ||
) { | ||
// Given | ||
testedFeature.onInitialize(appContext.mockInstance) | ||
val event = mapOf( | ||
"type" to RumFeature.MOBILE_METRIC_MESSAGE_TYPE, | ||
"message" to fakeMessage | ||
) | ||
|
||
// When | ||
testedFeature.onReceive(event) | ||
|
||
// Then | ||
verify(mockRumMonitor).sendMetricEvent(fakeMessage, null) | ||
verifyNoMoreInteractions(mockRumMonitor) | ||
verifyNoInteractions(mockInternalLogger) | ||
} | ||
|
||
@Test | ||
fun `𝕄 handle metric event 𝕎 onReceive(){no message}`() { | ||
// Given | ||
testedFeature.onInitialize(appContext.mockInstance) | ||
val event = mapOf( | ||
"type" to RumFeature.MOBILE_METRIC_MESSAGE_TYPE | ||
) | ||
|
||
// When | ||
testedFeature.onReceive(event) | ||
|
||
// Then | ||
mockInternalLogger.verifyLog( | ||
InternalLogger.Level.WARN, | ||
InternalLogger.Target.MAINTAINER, | ||
RumFeature.TELEMETRY_MISSING_MESSAGE_FIELD | ||
) | ||
verifyNoInteractions(mockRumMonitor) | ||
} | ||
|
||
@Test | ||
fun `𝕄 log warning 𝕎 onReceive() { telemetry error + message is missing }`() { | ||
// Given | ||
|
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.