mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-23 22:59:03 +00:00
Add test for OpenTelemetryServerRequestObservationConvention
See gh-35358
This commit is contained in:
committed by
Brian Clozel
parent
3269751887
commit
7e45f609a2
+1
-1
@@ -97,7 +97,7 @@ public enum OpenTelemetryServerHttpObservationDocumentation implements Observati
|
||||
},
|
||||
|
||||
/**
|
||||
* Name of the exception thrown during the exchange, or
|
||||
* Fully qualified name of the exception thrown during the exchange, or
|
||||
* {@value KeyValue#NONE_VALUE} if no exception was thrown.
|
||||
*/
|
||||
EXCEPTION {
|
||||
|
||||
+1
-4
@@ -29,7 +29,6 @@ import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.server.observation.OpenTelemetryServerHttpObservationDocumentation.HighCardinalityKeyNames;
|
||||
import org.springframework.http.server.observation.OpenTelemetryServerHttpObservationDocumentation.LowCardinalityKeyNames;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* A {@link ServerRequestObservationConvention} based on the stable OpenTelemetry semantic conventions.
|
||||
@@ -180,9 +179,7 @@ public class OpenTelemetryServerRequestObservationConvention implements ServerRe
|
||||
protected KeyValue exception(ServerRequestObservationContext context) {
|
||||
Throwable error = context.getError();
|
||||
if (error != null) {
|
||||
String simpleName = error.getClass().getSimpleName();
|
||||
return KeyValue.of(LowCardinalityKeyNames.EXCEPTION,
|
||||
StringUtils.hasText(simpleName) ? simpleName : error.getClass().getName());
|
||||
return KeyValue.of(LowCardinalityKeyNames.EXCEPTION, error.getClass().getName());
|
||||
}
|
||||
return EXCEPTION_NONE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user