Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Rzeszutek committed Oct 10, 2023
1 parent 9b1f3e8 commit 0b8bf3b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,11 @@ public void onEnd(
}

if (SemconvStability.emitStableHttpSemconv()) {
String errorType;
if (statusCode != null && statusCodeConverter.isError(statusCode)) {
errorType = statusCode.toString();
String errorType = null;
if (statusCode != null && statusCode > 0) {
if (statusCodeConverter.isError(statusCode)) {
errorType = statusCode.toString();
}
} else {
errorType = getter.getErrorType(request, response, error);
// fall back to exception class name & _OTHER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ static Stream<Arguments> spanStatusCodes() {
Arguments.of(429, false),
Arguments.of(431, false),
Arguments.of(451, false),
Arguments.of(500, false),
Arguments.of(501, false),
Arguments.of(502, false),
Arguments.of(503, false),
Arguments.of(504, false),
Arguments.of(505, false),
Arguments.of(506, false),
Arguments.of(507, false),
Arguments.of(508, false),
Arguments.of(510, false),
Arguments.of(511, false),
Arguments.of(500, true),
Arguments.of(501, true),
Arguments.of(502, true),
Arguments.of(503, true),
Arguments.of(504, true),
Arguments.of(505, true),
Arguments.of(506, true),
Arguments.of(507, true),
Arguments.of(508, true),
Arguments.of(510, true),
Arguments.of(511, true),

// Don't exist
Arguments.of(99, false),
Arguments.of(600, false));
Arguments.of(99, true),
Arguments.of(600, true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
import io.opentelemetry.instrumentation.api.internal.HttpConstants;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.instrumentation.test.utils.PortUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.context.propagation.TextMapPropagator;
import io.opentelemetry.context.propagation.TextMapSetter;
import io.opentelemetry.instrumentation.api.instrumenter.http.internal.HttpAttributes;
import io.opentelemetry.instrumentation.api.internal.HttpConstants;
import io.opentelemetry.instrumentation.api.internal.SemconvStability;
import io.opentelemetry.instrumentation.testing.GlobalTraceUtil;
Expand Down

0 comments on commit 0b8bf3b

Please sign in to comment.