Skip to content

Commit f028e77

Browse files
authored
All status codes below 400 are now mapped to SpanStatus.OK (#3869)
* Auto config for Spring Boot combined with OTel but without agent * try to cleanup otel classloader * make agent, no agent and agent without auto init work for spring boot * Fix ignored instrumentation for OTel without agent; separate sample for no agent * fix test result upload on CI * automatically detect otel and use OtelSpanFactory * POTEL 54 cleanup * fix non current span start child * consider status codes below 400 to be OK * changelog * remove file that re-emerged during merge
1 parent 73d19e1 commit f028e77

File tree

8 files changed

+14
-43
lines changed

8 files changed

+14
-43
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- `Session.getSessionId()` now returns a `String` instead of a `UUID`.
1010
- The Android minSdk level for all Android modules is now 21 ([#3852](https://github.com/getsentry/sentry-java/pull/3852))
1111
- The minSdk level for sentry-android-ndk changed from 19 to 21 ([#3851](https://github.com/getsentry/sentry-java/pull/3851))
12+
- All status codes below 400 are now mapped to `SpanStatus.OK` ([#3869](https://github.com/getsentry/sentry-java/pull/3869))
1213

1314
### Features
1415

@@ -48,6 +49,7 @@
4849
- Add `auto.graphql.graphql22` to ignored span origins when using OpenTelemetry ([#3828](https://github.com/getsentry/sentry-java/pull/3828))
4950
- The Spring Boot 3 WebFlux sample now uses our GraphQL v22 integration ([#3828](https://github.com/getsentry/sentry-java/pull/3828))
5051
- Accept manifest integer values when requiring floating values ([#3823](https://github.com/getsentry/sentry-java/pull/3823))
52+
- All status codes below 400 are now mapped to `SpanStatus.OK` ([#3869](https://github.com/getsentry/sentry-java/pull/3869))
5153

5254

5355
### Dependencies

sentry-spring-jakarta/src/main/java/io/sentry/spring/jakarta/opentelemetry/SentryOpenTelemetryConfiguration.java

Lines changed: 0 additions & 36 deletions
This file was deleted.

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)