Skip to content

Commit 132ee06

Browse files
authored
Merge db775cf into f2af5f2
2 parents f2af5f2 + db775cf commit 132ee06

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/tracing/SentryTracingFilterTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class SentryTracingFilterTest {
126126

127127
@Test
128128
fun `does not set span status for response status that dont match predefined span statuses`() {
129-
val filter = fixture.getSut(status = 302)
129+
val filter = fixture.getSut(status = 507)
130130

131131
filter.doFilter(fixture.request, fixture.response, fixture.chain)
132132

sentry-spring-jakarta/src/test/kotlin/io/sentry/spring/jakarta/webflux/SentryWebFluxTracingFilterTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class SentryWebFluxTracingFilterTest {
146146

147147
@Test
148148
fun `does not set span status for response status that dont match predefined span statuses`() {
149-
val filter = fixture.getSut(status = HttpStatus.FOUND)
149+
val filter = fixture.getSut(status = HttpStatus.INSUFFICIENT_STORAGE)
150150

151151
withMockScopes {
152152
filter.filter(fixture.exchange, fixture.chain).block()

sentry-spring/src/test/kotlin/io/sentry/spring/tracing/SentryTracingFilterTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class SentryTracingFilterTest {
126126

127127
@Test
128128
fun `does not set span status for response status that dont match predefined span statuses`() {
129-
val filter = fixture.getSut(status = 302)
129+
val filter = fixture.getSut(status = 507)
130130

131131
filter.doFilter(fixture.request, fixture.response, fixture.chain)
132132

sentry-spring/src/test/kotlin/io/sentry/spring/webflux/SentryWebFluxTracingFilterTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class SentryWebFluxTracingFilterTest {
147147

148148
@Test
149149
fun `does not set span status for response status that dont match predefined span statuses`() {
150-
val filter = fixture.getSut(status = HttpStatus.FOUND)
150+
val filter = fixture.getSut(status = HttpStatus.INSUFFICIENT_STORAGE)
151151

152152
withMockScopes {
153153
filter.filter(fixture.exchange, fixture.chain).block()

sentry/src/main/java/io/sentry/SpanStatus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
public enum SpanStatus implements JsonSerializable {
99
/** Not an error, returned on success. */
10-
OK(200, 299),
10+
OK(0, 399),
1111
/** The operation was cancelled, typically by the caller. */
1212
CANCELLED(499),
1313
/**

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,19 @@ class SpanStatusTest {
2121
assertEquals(SpanStatus.INTERNAL_ERROR, SpanStatus.fromHttpStatusCode(500))
2222
}
2323

24+
@Test
25+
fun `code 3xx is now also considered OK`() {
26+
assertEquals(SpanStatus.OK, SpanStatus.fromHttpStatusCode(304))
27+
}
28+
2429
@Test
2530
fun `returns null when no SpanStatus matches specific code`() {
26-
assertNull(SpanStatus.fromHttpStatusCode(302))
31+
assertNull(SpanStatus.fromHttpStatusCode(599))
2732
}
2833

2934
@Test
3035
fun `returns default value when no SpanStatus matches specific code`() {
31-
assertEquals(SpanStatus.UNKNOWN_ERROR, SpanStatus.fromHttpStatusCode(302, SpanStatus.UNKNOWN_ERROR))
36+
assertEquals(SpanStatus.UNKNOWN_ERROR, SpanStatus.fromHttpStatusCode(599, SpanStatus.UNKNOWN_ERROR))
3237
}
3338

3439
@Test

0 commit comments

Comments
 (0)