Skip to content

Commit f8db414

Browse files
committed
Format code
1 parent f4a473e commit f8db414

File tree

2 files changed

+77
-12
lines changed

2 files changed

+77
-12
lines changed

sentry/src/main/java/io/sentry/Scopes.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,8 @@ public void reportFullyDisplayed() {
11351135
final @Nullable String sentryTrace, final @Nullable List<String> baggageHeaders) {
11361136
@NotNull
11371137
PropagationContext propagationContext =
1138-
PropagationContext.fromHeaders(getOptions().getLogger(), sentryTrace, baggageHeaders, getOptions());
1138+
PropagationContext.fromHeaders(
1139+
getOptions().getLogger(), sentryTrace, baggageHeaders, getOptions());
11391140
configureScope(
11401141
(scope) -> {
11411142
scope.withPropagationContext(

sentry/src/test/java/io/sentry/PropagationContextTest.kt

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ class PropagationContextTest {
5050
private val incomingTraceId = "bc6d53f15eb88f4320054569b8c553d4"
5151
private val sentryTrace = "bc6d53f15eb88f4320054569b8c553d4-b72fa28504b07285-1"
5252

53-
private fun makeOptions(dsnOrgId: String?, explicitOrgId: String? = null, strict: Boolean = false): SentryOptions {
53+
private fun makeOptions(
54+
dsnOrgId: String?,
55+
explicitOrgId: String? = null,
56+
strict: Boolean = false,
57+
): SentryOptions {
5458
val options = SentryOptions()
5559
if (dsnOrgId != null) {
5660
options.dsn = "https://key@o$dsnOrgId.ingest.sentry.io/123"
@@ -73,70 +77,130 @@ class PropagationContextTest {
7377
@Test
7478
fun `strict=false, matching orgs - continues trace`() {
7579
val options = makeOptions(dsnOrgId = "1", strict = false)
76-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage("1"), options)
80+
val pc =
81+
PropagationContext.fromHeaders(
82+
NoOpLogger.getInstance(),
83+
sentryTrace,
84+
makeBaggage("1"),
85+
options,
86+
)
7787
assertEquals(incomingTraceId, pc.traceId.toString())
7888
}
7989

8090
@Test
8191
fun `strict=false, baggage missing org - continues trace`() {
8292
val options = makeOptions(dsnOrgId = "1", strict = false)
83-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage(null), options)
93+
val pc =
94+
PropagationContext.fromHeaders(
95+
NoOpLogger.getInstance(),
96+
sentryTrace,
97+
makeBaggage(null),
98+
options,
99+
)
84100
assertEquals(incomingTraceId, pc.traceId.toString())
85101
}
86102

87103
@Test
88104
fun `strict=false, sdk missing org - continues trace`() {
89105
val options = makeOptions(dsnOrgId = null, strict = false)
90-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage("1"), options)
106+
val pc =
107+
PropagationContext.fromHeaders(
108+
NoOpLogger.getInstance(),
109+
sentryTrace,
110+
makeBaggage("1"),
111+
options,
112+
)
91113
assertEquals(incomingTraceId, pc.traceId.toString())
92114
}
93115

94116
@Test
95117
fun `strict=false, both missing org - continues trace`() {
96118
val options = makeOptions(dsnOrgId = null, strict = false)
97-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage(null), options)
119+
val pc =
120+
PropagationContext.fromHeaders(
121+
NoOpLogger.getInstance(),
122+
sentryTrace,
123+
makeBaggage(null),
124+
options,
125+
)
98126
assertEquals(incomingTraceId, pc.traceId.toString())
99127
}
100128

101129
@Test
102130
fun `strict=false, mismatched orgs - starts new trace`() {
103131
val options = makeOptions(dsnOrgId = "2", strict = false)
104-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage("1"), options)
132+
val pc =
133+
PropagationContext.fromHeaders(
134+
NoOpLogger.getInstance(),
135+
sentryTrace,
136+
makeBaggage("1"),
137+
options,
138+
)
105139
assertNotEquals(incomingTraceId, pc.traceId.toString())
106140
}
107141

108142
@Test
109143
fun `strict=true, matching orgs - continues trace`() {
110144
val options = makeOptions(dsnOrgId = "1", strict = true)
111-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage("1"), options)
145+
val pc =
146+
PropagationContext.fromHeaders(
147+
NoOpLogger.getInstance(),
148+
sentryTrace,
149+
makeBaggage("1"),
150+
options,
151+
)
112152
assertEquals(incomingTraceId, pc.traceId.toString())
113153
}
114154

115155
@Test
116156
fun `strict=true, baggage missing org - starts new trace`() {
117157
val options = makeOptions(dsnOrgId = "1", strict = true)
118-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage(null), options)
158+
val pc =
159+
PropagationContext.fromHeaders(
160+
NoOpLogger.getInstance(),
161+
sentryTrace,
162+
makeBaggage(null),
163+
options,
164+
)
119165
assertNotEquals(incomingTraceId, pc.traceId.toString())
120166
}
121167

122168
@Test
123169
fun `strict=true, sdk missing org - starts new trace`() {
124170
val options = makeOptions(dsnOrgId = null, strict = true)
125-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage("1"), options)
171+
val pc =
172+
PropagationContext.fromHeaders(
173+
NoOpLogger.getInstance(),
174+
sentryTrace,
175+
makeBaggage("1"),
176+
options,
177+
)
126178
assertNotEquals(incomingTraceId, pc.traceId.toString())
127179
}
128180

129181
@Test
130182
fun `strict=true, both missing org - continues trace`() {
131183
val options = makeOptions(dsnOrgId = null, strict = true)
132-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage(null), options)
184+
val pc =
185+
PropagationContext.fromHeaders(
186+
NoOpLogger.getInstance(),
187+
sentryTrace,
188+
makeBaggage(null),
189+
options,
190+
)
133191
assertEquals(incomingTraceId, pc.traceId.toString())
134192
}
135193

136194
@Test
137195
fun `strict=true, mismatched orgs - starts new trace`() {
138196
val options = makeOptions(dsnOrgId = "2", strict = true)
139-
val pc = PropagationContext.fromHeaders(NoOpLogger.getInstance(), sentryTrace, makeBaggage("1"), options)
197+
val pc =
198+
PropagationContext.fromHeaders(
199+
NoOpLogger.getInstance(),
200+
sentryTrace,
201+
makeBaggage("1"),
202+
options,
203+
)
140204
assertNotEquals(incomingTraceId, pc.traceId.toString())
141205
}
142206
}

0 commit comments

Comments
 (0)