Skip to content

Commit 9233f8a

Browse files
committed
updated tests
1 parent b70a26c commit 9233f8a

11 files changed

+75
-88
lines changed

sentry-android-core/src/test/java/io/sentry/android/core/AndroidContinuousProfilerTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ class AndroidContinuousProfilerTest {
353353
val performanceCollector = mock<CompositePerformanceCollector>()
354354
val collectionData = PerformanceCollectionData()
355355

356-
collectionData.addMemoryData(MemoryCollectionData(1, 2, 3, SentryNanotimeDate()))
357-
collectionData.addCpuData(CpuCollectionData(1, 3.0, SentryNanotimeDate()))
356+
collectionData.addMemoryData(MemoryCollectionData(2, 3, SentryNanotimeDate()))
357+
collectionData.addCpuData(CpuCollectionData(3.0, SentryNanotimeDate()))
358358
whenever(performanceCollector.stop(any<String>())).thenReturn(listOf(collectionData))
359359

360360
fixture.options.compositePerformanceCollector = performanceCollector

sentry/api/sentry.api

+46-32
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,16 @@ public final class io/sentry/CombinedScopeView : io/sentry/IScope {
311311
public fun withTransaction (Lio/sentry/Scope$IWithTransaction;)V
312312
}
313313

314+
public abstract interface class io/sentry/CompositePerformanceCollector {
315+
public abstract fun close ()V
316+
public abstract fun onSpanFinished (Lio/sentry/ISpan;)V
317+
public abstract fun onSpanStarted (Lio/sentry/ISpan;)V
318+
public abstract fun start (Lio/sentry/ITransaction;)V
319+
public abstract fun start (Ljava/lang/String;)V
320+
public abstract fun stop (Lio/sentry/ITransaction;)Ljava/util/List;
321+
public abstract fun stop (Ljava/lang/String;)Ljava/util/List;
322+
}
323+
314324
public final class io/sentry/CpuCollectionData {
315325
public fun <init> (DLio/sentry/SentryDate;)V
316326
public fun getCpuUsagePercentage ()D
@@ -367,6 +377,17 @@ public final class io/sentry/DeduplicateMultithreadedEventProcessor : io/sentry/
367377
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
368378
}
369379

380+
public final class io/sentry/DefaultCompositePerformanceCollector : io/sentry/CompositePerformanceCollector {
381+
public fun <init> (Lio/sentry/SentryOptions;)V
382+
public fun close ()V
383+
public fun onSpanFinished (Lio/sentry/ISpan;)V
384+
public fun onSpanStarted (Lio/sentry/ISpan;)V
385+
public fun start (Lio/sentry/ITransaction;)V
386+
public fun start (Ljava/lang/String;)V
387+
public fun stop (Lio/sentry/ITransaction;)Ljava/util/List;
388+
public fun stop (Ljava/lang/String;)Ljava/util/List;
389+
}
390+
370391
public final class io/sentry/DefaultScopesStorage : io/sentry/IScopesStorage {
371392
public fun <init> ()V
372393
public fun close ()V
@@ -377,16 +398,7 @@ public final class io/sentry/DefaultScopesStorage : io/sentry/IScopesStorage {
377398
public final class io/sentry/DefaultSpanFactory : io/sentry/ISpanFactory {
378399
public fun <init> ()V
379400
public fun createSpan (Lio/sentry/IScopes;Lio/sentry/SpanOptions;Lio/sentry/SpanContext;Lio/sentry/ISpan;)Lio/sentry/ISpan;
380-
public fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/TransactionPerformanceCollector;)Lio/sentry/ITransaction;
381-
}
382-
383-
public final class io/sentry/DefaultTransactionPerformanceCollector : io/sentry/TransactionPerformanceCollector {
384-
public fun <init> (Lio/sentry/SentryOptions;)V
385-
public fun close ()V
386-
public fun onSpanFinished (Lio/sentry/ISpan;)V
387-
public fun onSpanStarted (Lio/sentry/ISpan;)V
388-
public fun start (Lio/sentry/ITransaction;)V
389-
public fun stop (Lio/sentry/ITransaction;)Ljava/util/List;
401+
public fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/CompositePerformanceCollector;)Lio/sentry/ITransaction;
390402
}
391403

392404
public final class io/sentry/DiagnosticLogger : io/sentry/ILogger {
@@ -700,6 +712,7 @@ public abstract interface class io/sentry/IConnectionStatusProvider$IConnectionS
700712

701713
public abstract interface class io/sentry/IContinuousProfiler {
702714
public abstract fun close ()V
715+
public abstract fun getProfilerId ()Lio/sentry/protocol/SentryId;
703716
public abstract fun isRunning ()Z
704717
public abstract fun setScopes (Lio/sentry/IScopes;)V
705718
public abstract fun start ()V
@@ -1018,7 +1031,7 @@ public abstract interface class io/sentry/ISpan {
10181031

10191032
public abstract interface class io/sentry/ISpanFactory {
10201033
public abstract fun createSpan (Lio/sentry/IScopes;Lio/sentry/SpanOptions;Lio/sentry/SpanContext;Lio/sentry/ISpan;)Lio/sentry/ISpan;
1021-
public abstract fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/TransactionPerformanceCollector;)Lio/sentry/ITransaction;
1034+
public abstract fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/CompositePerformanceCollector;)Lio/sentry/ITransaction;
10221035
}
10231036

10241037
public abstract interface class io/sentry/ITransaction : io/sentry/ISpan {
@@ -1358,6 +1371,17 @@ public final class io/sentry/MonitorScheduleUnit : java/lang/Enum {
13581371
public static fun values ()[Lio/sentry/MonitorScheduleUnit;
13591372
}
13601373

1374+
public final class io/sentry/NoOpCompositePerformanceCollector : io/sentry/CompositePerformanceCollector {
1375+
public fun close ()V
1376+
public static fun getInstance ()Lio/sentry/NoOpCompositePerformanceCollector;
1377+
public fun onSpanFinished (Lio/sentry/ISpan;)V
1378+
public fun onSpanStarted (Lio/sentry/ISpan;)V
1379+
public fun start (Lio/sentry/ITransaction;)V
1380+
public fun start (Ljava/lang/String;)V
1381+
public fun stop (Lio/sentry/ITransaction;)Ljava/util/List;
1382+
public fun stop (Ljava/lang/String;)Ljava/util/List;
1383+
}
1384+
13611385
public final class io/sentry/NoOpConnectionStatusProvider : io/sentry/IConnectionStatusProvider {
13621386
public fun <init> ()V
13631387
public fun addConnectionStatusObserver (Lio/sentry/IConnectionStatusProvider$IConnectionStatusObserver;)Z
@@ -1369,6 +1393,7 @@ public final class io/sentry/NoOpConnectionStatusProvider : io/sentry/IConnectio
13691393
public final class io/sentry/NoOpContinuousProfiler : io/sentry/IContinuousProfiler {
13701394
public fun close ()V
13711395
public static fun getInstance ()Lio/sentry/NoOpContinuousProfiler;
1396+
public fun getProfilerId ()Lio/sentry/protocol/SentryId;
13721397
public fun isRunning ()Z
13731398
public fun setScopes (Lio/sentry/IScopes;)V
13741399
public fun start ()V
@@ -1661,7 +1686,7 @@ public final class io/sentry/NoOpSpan : io/sentry/ISpan {
16611686

16621687
public final class io/sentry/NoOpSpanFactory : io/sentry/ISpanFactory {
16631688
public fun createSpan (Lio/sentry/IScopes;Lio/sentry/SpanOptions;Lio/sentry/SpanContext;Lio/sentry/ISpan;)Lio/sentry/ISpan;
1664-
public fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/TransactionPerformanceCollector;)Lio/sentry/ITransaction;
1689+
public fun createTransaction (Lio/sentry/TransactionContext;Lio/sentry/IScopes;Lio/sentry/TransactionOptions;Lio/sentry/CompositePerformanceCollector;)Lio/sentry/ITransaction;
16651690
public static fun getInstance ()Lio/sentry/NoOpSpanFactory;
16661691
}
16671692

@@ -1718,15 +1743,6 @@ public final class io/sentry/NoOpTransaction : io/sentry/ITransaction {
17181743
public fun updateEndDate (Lio/sentry/SentryDate;)Z
17191744
}
17201745

1721-
public final class io/sentry/NoOpTransactionPerformanceCollector : io/sentry/TransactionPerformanceCollector {
1722-
public fun close ()V
1723-
public static fun getInstance ()Lio/sentry/NoOpTransactionPerformanceCollector;
1724-
public fun onSpanFinished (Lio/sentry/ISpan;)V
1725-
public fun onSpanStarted (Lio/sentry/ISpan;)V
1726-
public fun start (Lio/sentry/ITransaction;)V
1727-
public fun stop (Lio/sentry/ITransaction;)Ljava/util/List;
1728-
}
1729-
17301746
public final class io/sentry/NoOpTransactionProfiler : io/sentry/ITransactionProfiler {
17311747
public fun bindTransaction (Lio/sentry/ITransaction;)V
17321748
public fun close ()V
@@ -1860,7 +1876,7 @@ public final class io/sentry/ProfileChunk$JsonKeys {
18601876
public fun <init> ()V
18611877
}
18621878

1863-
public class io/sentry/ProfileContext : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
1879+
public final class io/sentry/ProfileContext : io/sentry/JsonSerializable, io/sentry/JsonUnknown {
18641880
public static final field TYPE Ljava/lang/String;
18651881
public fun <init> ()V
18661882
public fun <init> (Lio/sentry/ProfileContext;)V
@@ -2899,9 +2915,11 @@ public class io/sentry/SentryOptions {
28992915
public fun getBundleIds ()Ljava/util/Set;
29002916
public fun getCacheDirPath ()Ljava/lang/String;
29012917
public fun getClientReportRecorder ()Lio/sentry/clientreport/IClientReportRecorder;
2918+
public fun getCompositePerformanceCollector ()Lio/sentry/CompositePerformanceCollector;
29022919
public fun getConnectionStatusProvider ()Lio/sentry/IConnectionStatusProvider;
29032920
public fun getConnectionTimeoutMillis ()I
29042921
public fun getContextTags ()Ljava/util/List;
2922+
public fun getContinuousProfiler ()Lio/sentry/IContinuousProfiler;
29052923
public fun getCron ()Lio/sentry/SentryOptions$Cron;
29062924
public fun getDateProvider ()Lio/sentry/SentryDateProvider;
29072925
public fun getDebugMetaLoader ()Lio/sentry/internal/debugmeta/IDebugMetaLoader;
@@ -2968,7 +2986,6 @@ public class io/sentry/SentryOptions {
29682986
public fun getTracePropagationTargets ()Ljava/util/List;
29692987
public fun getTracesSampleRate ()Ljava/lang/Double;
29702988
public fun getTracesSampler ()Lio/sentry/SentryOptions$TracesSamplerCallback;
2971-
public fun getTransactionPerformanceCollector ()Lio/sentry/TransactionPerformanceCollector;
29722989
public fun getTransactionProfiler ()Lio/sentry/ITransactionProfiler;
29732990
public fun getTransportFactory ()Lio/sentry/ITransportFactory;
29742991
public fun getTransportGate ()Lio/sentry/transport/ITransportGate;
@@ -3012,8 +3029,10 @@ public class io/sentry/SentryOptions {
30123029
public fun setBeforeSend (Lio/sentry/SentryOptions$BeforeSendCallback;)V
30133030
public fun setBeforeSendTransaction (Lio/sentry/SentryOptions$BeforeSendTransactionCallback;)V
30143031
public fun setCacheDirPath (Ljava/lang/String;)V
3032+
public fun setCompositePerformanceCollector (Lio/sentry/CompositePerformanceCollector;)V
30153033
public fun setConnectionStatusProvider (Lio/sentry/IConnectionStatusProvider;)V
30163034
public fun setConnectionTimeoutMillis (I)V
3035+
public fun setContinuousProfiler (Lio/sentry/IContinuousProfiler;)V
30173036
public fun setCron (Lio/sentry/SentryOptions$Cron;)V
30183037
public fun setDateProvider (Lio/sentry/SentryDateProvider;)V
30193038
public fun setDebug (Z)V
@@ -3092,7 +3111,6 @@ public class io/sentry/SentryOptions {
30923111
public fun setTraceSampling (Z)V
30933112
public fun setTracesSampleRate (Ljava/lang/Double;)V
30943113
public fun setTracesSampler (Lio/sentry/SentryOptions$TracesSamplerCallback;)V
3095-
public fun setTransactionPerformanceCollector (Lio/sentry/TransactionPerformanceCollector;)V
30963114
public fun setTransactionProfiler (Lio/sentry/ITransactionProfiler;)V
30973115
public fun setTransportFactory (Lio/sentry/ITransportFactory;)V
30983116
public fun setTransportGate (Lio/sentry/transport/ITransportGate;)V
@@ -3579,6 +3597,7 @@ public abstract interface class io/sentry/SpanDataConvention {
35793597
public static final field HTTP_RESPONSE_CONTENT_LENGTH_KEY Ljava/lang/String;
35803598
public static final field HTTP_START_TIMESTAMP Ljava/lang/String;
35813599
public static final field HTTP_STATUS_CODE_KEY Ljava/lang/String;
3600+
public static final field PROFILER_ID Ljava/lang/String;
35823601
public static final field THREAD_ID Ljava/lang/String;
35833602
public static final field THREAD_NAME Ljava/lang/String;
35843603
}
@@ -3762,14 +3781,6 @@ public final class io/sentry/TransactionOptions : io/sentry/SpanOptions {
37623781
public fun setWaitForChildren (Z)V
37633782
}
37643783

3765-
public abstract interface class io/sentry/TransactionPerformanceCollector {
3766-
public abstract fun close ()V
3767-
public abstract fun onSpanFinished (Lio/sentry/ISpan;)V
3768-
public abstract fun onSpanStarted (Lio/sentry/ISpan;)V
3769-
public abstract fun start (Lio/sentry/ITransaction;)V
3770-
public abstract fun stop (Lio/sentry/ITransaction;)Ljava/util/List;
3771-
}
3772-
37733784
public final class io/sentry/TypeCheckHint {
37743785
public static final field ANDROID_ACTIVITY Ljava/lang/String;
37753786
public static final field ANDROID_CONFIGURATION Ljava/lang/String;
@@ -6341,6 +6352,7 @@ public final class io/sentry/util/UrlUtils$UrlDetails {
63416352

63426353
public abstract interface class io/sentry/util/thread/IThreadChecker {
63436354
public abstract fun currentThreadSystemId ()J
6355+
public abstract fun getCurrentThreadName ()Ljava/lang/String;
63446356
public abstract fun isMainThread ()Z
63456357
public abstract fun isMainThread (J)Z
63466358
public abstract fun isMainThread (Lio/sentry/protocol/SentryThread;)Z
@@ -6350,6 +6362,7 @@ public abstract interface class io/sentry/util/thread/IThreadChecker {
63506362
public final class io/sentry/util/thread/NoOpThreadChecker : io/sentry/util/thread/IThreadChecker {
63516363
public fun <init> ()V
63526364
public fun currentThreadSystemId ()J
6365+
public fun getCurrentThreadName ()Ljava/lang/String;
63536366
public static fun getInstance ()Lio/sentry/util/thread/NoOpThreadChecker;
63546367
public fun isMainThread ()Z
63556368
public fun isMainThread (J)Z
@@ -6359,6 +6372,7 @@ public final class io/sentry/util/thread/NoOpThreadChecker : io/sentry/util/thre
63596372

63606373
public final class io/sentry/util/thread/ThreadChecker : io/sentry/util/thread/IThreadChecker {
63616374
public fun currentThreadSystemId ()J
6375+
public fun getCurrentThreadName ()Ljava/lang/String;
63626376
public static fun getInstance ()Lio/sentry/util/thread/ThreadChecker;
63636377
public fun isMainThread ()Z
63646378
public fun isMainThread (J)Z

sentry/src/test/resources/json/contexts.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,6 @@
115115
"description": "c204b6c7-9753-4d45-927d-b19789bfc9a5",
116116
"status": "resource_exhausted",
117117
"origin": "auto.test.unit.spancontext",
118-
"data":
119-
{
120-
"thread.name": "test",
121-
"thread.id": 10
122-
},
123118
"tags":
124119
{
125120
"2a5fa3f5-7b87-487f-aaa5-84567aa73642": "4781d51a-c5af-47f2-a4ed-f030c9b3e194",
@@ -128,7 +123,9 @@
128123
},
129124
"data":
130125
{
131-
"spanContextDataKey": "spanContextDataValue"
126+
"spanContextDataKey": "spanContextDataValue",
127+
"thread.name": "test",
128+
"thread.id": 10
132129
}
133130
}
134131
}

sentry/src/test/resources/json/sentry_base_event.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@
118118
"description": "c204b6c7-9753-4d45-927d-b19789bfc9a5",
119119
"status": "resource_exhausted",
120120
"origin": "auto.test.unit.spancontext",
121-
"data":
122-
{
123-
"thread.name": "test",
124-
"thread.id": 10
125-
},
126121
"tags":
127122
{
128123
"2a5fa3f5-7b87-487f-aaa5-84567aa73642": "4781d51a-c5af-47f2-a4ed-f030c9b3e194",
@@ -131,7 +126,9 @@
131126
},
132127
"data":
133128
{
134-
"spanContextDataKey": "spanContextDataValue"
129+
"spanContextDataKey": "spanContextDataValue",
130+
"thread.name": "test",
131+
"thread.id": 10
135132
}
136133
}
137134
},

sentry/src/test/resources/json/sentry_base_event_with_null_extra.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@
118118
"description": "c204b6c7-9753-4d45-927d-b19789bfc9a5",
119119
"status": "resource_exhausted",
120120
"origin": "auto.test.unit.spancontext",
121-
"data":
122-
{
123-
"thread.name": "test",
124-
"thread.id": 10
125-
},
126121
"tags":
127122
{
128123
"2a5fa3f5-7b87-487f-aaa5-84567aa73642": "4781d51a-c5af-47f2-a4ed-f030c9b3e194",
@@ -131,7 +126,9 @@
131126
},
132127
"data":
133128
{
134-
"spanContextDataKey": "spanContextDataValue"
129+
"spanContextDataKey": "spanContextDataValue",
130+
"thread.name": "test",
131+
"thread.id": 10
135132
}
136133
}
137134
},

sentry/src/test/resources/json/sentry_event.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,6 @@
253253
"description": "c204b6c7-9753-4d45-927d-b19789bfc9a5",
254254
"status": "resource_exhausted",
255255
"origin": "auto.test.unit.spancontext",
256-
"data":
257-
{
258-
"thread.name": "test",
259-
"thread.id": 10
260-
},
261256
"tags":
262257
{
263258
"2a5fa3f5-7b87-487f-aaa5-84567aa73642": "4781d51a-c5af-47f2-a4ed-f030c9b3e194",
@@ -266,7 +261,9 @@
266261
},
267262
"data":
268263
{
269-
"spanContextDataKey": "spanContextDataValue"
264+
"spanContextDataKey": "spanContextDataValue",
265+
"thread.name": "test",
266+
"thread.id": 10
270267
}
271268
}
272269
},

sentry/src/test/resources/json/sentry_replay_event.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@
136136
"description": "c204b6c7-9753-4d45-927d-b19789bfc9a5",
137137
"status": "resource_exhausted",
138138
"origin": "auto.test.unit.spancontext",
139-
"data":
140-
{
141-
"thread.name": "test",
142-
"thread.id": 10
143-
},
144139
"tags":
145140
{
146141
"2a5fa3f5-7b87-487f-aaa5-84567aa73642": "4781d51a-c5af-47f2-a4ed-f030c9b3e194",
@@ -149,7 +144,9 @@
149144
},
150145
"data":
151146
{
152-
"spanContextDataKey": "spanContextDataValue"
147+
"spanContextDataKey": "spanContextDataValue",
148+
"thread.name": "test",
149+
"thread.id": 10
153150
}
154151
}
155152
},

sentry/src/test/resources/json/sentry_transaction.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@
175175
"description": "c204b6c7-9753-4d45-927d-b19789bfc9a5",
176176
"status": "resource_exhausted",
177177
"origin": "auto.test.unit.spancontext",
178-
"data":
179-
{
180-
"thread.name": "test",
181-
"thread.id": 10
182-
},
183178
"tags":
184179
{
185180
"2a5fa3f5-7b87-487f-aaa5-84567aa73642": "4781d51a-c5af-47f2-a4ed-f030c9b3e194",
@@ -188,7 +183,9 @@
188183
},
189184
"data":
190185
{
191-
"spanContextDataKey": "spanContextDataValue"
186+
"spanContextDataKey": "spanContextDataValue",
187+
"thread.name": "test",
188+
"thread.id": 10
192189
}
193190
}
194191
},

sentry/src/test/resources/json/sentry_transaction_legacy_date_format.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@
175175
"description": "c204b6c7-9753-4d45-927d-b19789bfc9a5",
176176
"status": "resource_exhausted",
177177
"origin": "auto.test.unit.spancontext",
178-
"data":
179-
{
180-
"thread.name": "test",
181-
"thread.id": 10
182-
},
183178
"tags":
184179
{
185180
"2a5fa3f5-7b87-487f-aaa5-84567aa73642": "4781d51a-c5af-47f2-a4ed-f030c9b3e194",
@@ -188,7 +183,9 @@
188183
},
189184
"data":
190185
{
191-
"spanContextDataKey": "spanContextDataValue"
186+
"spanContextDataKey": "spanContextDataValue",
187+
"thread.name": "test",
188+
"thread.id": 10
192189
}
193190
}
194191
},

0 commit comments

Comments
 (0)