Skip to content

Commit f3d13bd

Browse files
committed
RUM-8375: fix some tests
1 parent 07f3006 commit f3d13bd

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/internal/attributes/LocalAttribute.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface LocalAttribute {
2929
* In such cases we need to use *creationSampleRate* to compute effectiveSampleRate correctlyThe sampling
3030
* rate is used when creating metrics.
3131
* Creation(head) sampling rate exist only for long-lived metrics like method performance.
32-
* Created metric still could not be sent it depends on [REPORTING_SAMPLING_RATE_KEY] sampling rate
32+
* Created metric still could not be sent it depends on [REPORTING_SAMPLING_RATE] sampling rate
3333
*/
3434
CREATION_SAMPLING_RATE("_dd.local.head_sampling_rate_key"),
3535

dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/internal/logger/SdkInternalLoggerTest.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import com.datadog.android.api.InternalLogger
1212
import com.datadog.android.api.feature.Feature
1313
import com.datadog.android.api.feature.FeatureScope
1414
import com.datadog.android.api.feature.FeatureSdkCore
15+
import com.datadog.android.core.internal.attributes.LocalAttribute
1516
import com.datadog.android.core.internal.metrics.MethodCalledTelemetry
1617
import com.datadog.android.core.metrics.TelemetryMetricType
1718
import com.datadog.android.internal.telemetry.InternalTelemetryEvent
@@ -452,7 +453,7 @@ internal class SdkInternalLoggerTest {
452453
// Given
453454
val samplingRate = 100.0f
454455
val fakeAdditionalProperties = forge.exhaustiveAttributes().also {
455-
it[InternalTelemetryEvent.REPORTING_SAMPLING_RATE_KEY] = samplingRate
456+
it[LocalAttribute.Key.REPORTING_SAMPLING_RATE.string] = samplingRate
456457
}
457458
val mockLambda: () -> String = mock()
458459
whenever(mockLambda.invoke()) doReturn fakeMessage
@@ -504,13 +505,13 @@ internal class SdkInternalLoggerTest {
504505
val metricEvent = firstValue as InternalTelemetryEvent.Metric
505506

506507
assertThat(
507-
metricEvent.additionalProperties?.get(InternalTelemetryEvent.CREATION_SAMPLING_RATE_KEY)
508+
metricEvent.additionalProperties?.get(LocalAttribute.Key.CREATION_SAMPLING_RATE.string)
508509
).isEqualTo(
509510
expectedCreationSampleRate
510511
)
511512

512513
assertThat(
513-
metricEvent.additionalProperties?.get(InternalTelemetryEvent.REPORTING_SAMPLING_RATE_KEY)
514+
metricEvent.additionalProperties?.get(LocalAttribute.Key.REPORTING_SAMPLING_RATE.string)
514515
).isEqualTo(
515516
samplingRate
516517
)
@@ -543,11 +544,11 @@ internal class SdkInternalLoggerTest {
543544
assertThat(
544545
apiUsageEvent.additionalProperties
545546
).doesNotContainKeys(
546-
InternalTelemetryEvent.CREATION_SAMPLING_RATE_KEY
547+
LocalAttribute.Key.CREATION_SAMPLING_RATE.string
547548
)
548549

549550
assertThat(
550-
apiUsageEvent.additionalProperties[InternalTelemetryEvent.REPORTING_SAMPLING_RATE_KEY]
551+
apiUsageEvent.additionalProperties[LocalAttribute.Key.REPORTING_SAMPLING_RATE.string]
551552
).isEqualTo(
552553
samplingRate
553554
)
@@ -568,7 +569,7 @@ internal class SdkInternalLoggerTest {
568569
),
569570
target = InternalLogger.Target.TELEMETRY,
570571
messageBuilder = { forge.aString() },
571-
additionalProperties = mapOf(InternalTelemetryEvent.REPORTING_SAMPLING_RATE_KEY to samplingRate)
572+
additionalProperties = mapOf(LocalAttribute.Key.REPORTING_SAMPLING_RATE.string to samplingRate)
572573
)
573574

574575
// Then
@@ -580,11 +581,11 @@ internal class SdkInternalLoggerTest {
580581
assertThat(
581582
debugEvent.additionalProperties
582583
).doesNotContainKeys(
583-
InternalTelemetryEvent.CREATION_SAMPLING_RATE_KEY
584+
LocalAttribute.Key.CREATION_SAMPLING_RATE.string
584585
)
585586

586587
assertThat(
587-
debugEvent.additionalProperties?.get(InternalTelemetryEvent.REPORTING_SAMPLING_RATE_KEY)
588+
debugEvent.additionalProperties?.get(LocalAttribute.Key.REPORTING_SAMPLING_RATE.string)
588589
).isEqualTo(
589590
samplingRate
590591
)
@@ -603,7 +604,7 @@ internal class SdkInternalLoggerTest {
603604
target = InternalLogger.Target.TELEMETRY,
604605
throwable = forge.aThrowable(),
605606
messageBuilder = { forge.aString() },
606-
additionalProperties = mapOf(InternalTelemetryEvent.REPORTING_SAMPLING_RATE_KEY to samplingRate)
607+
additionalProperties = mapOf(LocalAttribute.Key.REPORTING_SAMPLING_RATE.string to samplingRate)
607608
)
608609

609610
// Then
@@ -615,11 +616,11 @@ internal class SdkInternalLoggerTest {
615616
assertThat(
616617
debugEvent.additionalProperties
617618
).doesNotContainKeys(
618-
InternalTelemetryEvent.CREATION_SAMPLING_RATE_KEY
619+
LocalAttribute.Key.CREATION_SAMPLING_RATE.string
619620
)
620621

621622
assertThat(
622-
debugEvent.additionalProperties?.get(InternalTelemetryEvent.REPORTING_SAMPLING_RATE_KEY)
623+
debugEvent.additionalProperties?.get(LocalAttribute.Key.REPORTING_SAMPLING_RATE.string)
623624
).isEqualTo(
624625
samplingRate
625626
)

0 commit comments

Comments
 (0)