Skip to content

Commit

Permalink
spotless apply
Browse files Browse the repository at this point in the history
  • Loading branch information
shashank11p committed Oct 4, 2023
1 parent d1c3803 commit 798ab73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ private InputStreamUtils() {}

static {
try {
getAttribute = Class.forName("io.opentelemetry.sdk.trace.SdkSpan").getDeclaredMethod("getAttribute", AttributeKey.class);
getAttribute =
Class.forName("io.opentelemetry.sdk.trace.SdkSpan")
.getDeclaredMethod("getAttribute", AttributeKey.class);
} catch (NoSuchMethodException e) {
log.error("getAttribute method not found in SdkSpan class", e);
} catch (ClassNotFoundException e) {
Expand All @@ -75,10 +77,12 @@ public static void addAttribute(Span span, AttributeKey<String> attributeKey, St
.setAttribute(attributeKey, value);

// Also add content type if present
if (getAttribute != null && span.getClass().getName().equals("io.opentelemetry.sdk.trace.SdkSpan")) {
if (getAttribute != null
&& span.getClass().getName().equals("io.opentelemetry.sdk.trace.SdkSpan")) {
try {
Object reqContentType =
getAttribute.invoke(span, HypertraceSemanticAttributes.HTTP_REQUEST_HEADER_CONTENT_TYPE);
getAttribute.invoke(
span, HypertraceSemanticAttributes.HTTP_REQUEST_HEADER_CONTENT_TYPE);
if (reqContentType != null) {
spanBuilder.setAttribute("http.request.header.content-type", (String) reqContentType);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public class ResponseBodyWrappingHandler implements Handler<Buffer> {

static {
try {
getAttribute = Class.forName("io.opentelemetry.sdk.trace.SdkSpan").getDeclaredMethod("getAttribute", AttributeKey.class);
getAttribute =
Class.forName("io.opentelemetry.sdk.trace.SdkSpan")
.getDeclaredMethod("getAttribute", AttributeKey.class);
} catch (NoSuchMethodException e) {
log.error("getAttribute method not found in SdkSpan class", e);
} catch (ClassNotFoundException e) {
Expand Down Expand Up @@ -73,7 +75,8 @@ public void handle(Buffer event) {
.setAttribute(HypertraceSemanticAttributes.HTTP_RESPONSE_BODY, responseBody);

// Also add content type if present
if (getAttribute != null && span.getClass().getName().equals("io.opentelemetry.sdk.trace.SdkSpan")) {
if (getAttribute != null
&& span.getClass().getName().equals("io.opentelemetry.sdk.trace.SdkSpan")) {
try {
Object resContentType =
getAttribute.invoke(
Expand Down

0 comments on commit 798ab73

Please sign in to comment.