Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import io.sentry.SentryNanotimeDate
import io.sentry.SentryStackTraceFactory
import io.sentry.SpanDataConvention
import io.sentry.SpanStatus
import java.util.Date

private const val SQLITE_TRACE_ORIGIN = "auto.db.sqlite"

/**
* Sentinel for extracting a [SentryNanotimeDate]'s underlying [System.nanoTime] value via
* [SentryDate.diff].
*/
private val EMPTY_NANO_TIME = SentryNanotimeDate(Date(0), 0L)
private val EMPTY_NANO_TIME = SentryNanotimeDate(0, 0L)

/** Span instrumentation for [SentrySQLiteDriver]. */
internal class SQLiteSpanInstrumentation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import io.sentry.DateUtils
import io.sentry.ISpan
import io.sentry.SentryLongDate
import io.sentry.SentryNanotimeDate
import java.util.Date
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
Expand Down Expand Up @@ -86,7 +85,7 @@ class ComputeNanoStartTimestampForChildTest {
}

private fun spanWithNanotimeStart(wallClockMillis: Long, parentMonotonicNanos: Long): ISpan {
val startDate = SentryNanotimeDate(Date(wallClockMillis), parentMonotonicNanos)
val startDate = SentryNanotimeDate(wallClockMillis, parentMonotonicNanos)
val span = mock<ISpan>()
whenever(span.startDate).thenReturn(startDate)
return span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import io.sentry.SpanDataConvention
import io.sentry.SpanStatus
import io.sentry.TransactionContext
import io.sentry.util.thread.IThreadChecker
import java.util.Date
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
Expand Down Expand Up @@ -51,7 +50,7 @@ class SQLiteSpanInstrumentationTest {
// Only the parent date is queued. If startTimestamp() were to call dateProvider.now(),
// the queue would underflow and the test would fail loudly — this is what verifies the
// optimization is in effect.
val parentDate = SentryNanotimeDate(Date(1_000_000L), 100_000_000L)
val parentDate = SentryNanotimeDate(1_000_000L, 100_000_000L)
val sut = setUpWithNanotimeDates(parentDate)

val start = sut.startTimestamp()
Expand All @@ -71,7 +70,7 @@ class SQLiteSpanInstrumentationTest {

@Test
fun `startTimestamp falls back to date provider when parent does not use SentryNanotimeDate`() {
val providerDate = SentryNanotimeDate(Date(2_000_000L), 200_000_000L)
val providerDate = SentryNanotimeDate(2_000_000L, 200_000_000L)
val parentSpan = mock<ISpan>()
whenever(parentSpan.startDate).thenReturn(SentryLongDate(1_000_000_000_000_000L))
val options =
Expand All @@ -89,7 +88,7 @@ class SQLiteSpanInstrumentationTest {

@Test
fun `startTimestamp falls back to date provider when no transaction is active`() {
val providerDate = SentryNanotimeDate(Date(2_000_000L), 200_000_000L)
val providerDate = SentryNanotimeDate(2_000_000L, 200_000_000L)
val options =
SentryOptions().apply {
dsn = "https://key@sentry.io/proj"
Expand Down
Loading