Skip to content

Commit 466971e

Browse files
committed
fix style
1 parent b859165 commit 466971e

File tree

22 files changed

+186
-92
lines changed

22 files changed

+186
-92
lines changed

instrumentation/jsonrpc4j-1.6/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jsonrpc4j/v1_6/JsonRpcClientBuilderInstrumentation.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public static void onExit(
9595
new SimpleJsonRpcRequest(methodName, argument),
9696
new SimpleJsonRpcResponse(result),
9797
throwable);
98-
System.out.println(extraHeaders);
9998
}
10099
}
101100
}

instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/HeadersSetter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

38
import io.opentelemetry.context.propagation.TextMapSetter;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

38
import io.opentelemetry.api.common.AttributesBuilder;
@@ -6,18 +11,19 @@
611
import javax.annotation.Nullable;
712

813
// Check https://opentelemetry.io/docs/specs/semconv/rpc/json-rpc/
9-
final class JsonRpcClientAttributesExtractor implements AttributesExtractor<SimpleJsonRpcRequest, SimpleJsonRpcResponse> {
14+
final class JsonRpcClientAttributesExtractor
15+
implements AttributesExtractor<SimpleJsonRpcRequest, SimpleJsonRpcResponse> {
1016

11-
// private final JsonRpcClientAttributesGetter getter;
12-
//
13-
//
14-
// JsonRpcClientAttributesExtractor(JsonRpcClientAttributesGetter getter) {
15-
// this.getter = getter;
16-
// }
17+
// private final JsonRpcClientAttributesGetter getter;
18+
//
19+
//
20+
// JsonRpcClientAttributesExtractor(JsonRpcClientAttributesGetter getter) {
21+
// this.getter = getter;
22+
// }
1723

1824
@Override
19-
public void onStart(AttributesBuilder attributes, Context parentContext,
20-
SimpleJsonRpcRequest jsonRpcRequest) {
25+
public void onStart(
26+
AttributesBuilder attributes, Context parentContext, SimpleJsonRpcRequest jsonRpcRequest) {
2127
attributes.put("rpc.jsonrpc.version", "2.0");
2228
}
2329

@@ -27,7 +33,5 @@ public void onEnd(
2733
Context context,
2834
SimpleJsonRpcRequest jsonRpcRequest,
2935
@Nullable SimpleJsonRpcResponse jsonRpcResponse,
30-
@Nullable Throwable error) {
31-
32-
}
36+
@Nullable Throwable error) {}
3337
}

instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcClientAttributesGetter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

38
import io.opentelemetry.instrumentation.api.incubator.semconv.rpc.RpcAttributesGetter;
49

5-
// Check https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-metrics.md#attributes
10+
// Check
11+
// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-metrics.md#attributes
612
// Check https://opentelemetry.io/docs/specs/semconv/rpc/json-rpc/
713
public enum JsonRpcClientAttributesGetter implements RpcAttributesGetter<SimpleJsonRpcRequest> {
814
INSTANCE;

instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcClientSpanNameExtractor.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

38
import io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor;
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

8+
import com.fasterxml.jackson.databind.JsonNode;
39
import java.lang.reflect.Method;
410
import java.util.List;
5-
import com.fasterxml.jackson.databind.JsonNode;
611

712
public final class JsonRpcRequest {
813

@@ -14,14 +19,11 @@ public final class JsonRpcRequest {
1419
this.arguments = arguments;
1520
}
1621

17-
1822
public Method getMethod() {
1923
return method;
2024
}
2125

2226
public List<JsonNode> getArguments() {
2327
return arguments;
2428
}
25-
26-
2729
}

instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcRequestGetter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

38
import io.opentelemetry.context.propagation.TextMapGetter;
4-
import javax.annotation.Nullable;
59
import java.util.ArrayList;
10+
import javax.annotation.Nullable;
611

712
enum JsonRpcRequestGetter implements TextMapGetter<JsonRpcRequest> {
813
INSTANCE;

instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcResponse.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

8+
import com.fasterxml.jackson.databind.JsonNode;
39
import java.lang.reflect.Method;
410
import java.util.List;
5-
import com.fasterxml.jackson.databind.JsonNode;
611

712
public final class JsonRpcResponse {
813
private final Method method;

instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcServerAttributesExtractor.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

38
import com.googlecode.jsonrpc4j.AnnotationsErrorResolver;
@@ -11,24 +16,25 @@
1116
import javax.annotation.Nullable;
1217

1318
// Check https://opentelemetry.io/docs/specs/semconv/rpc/json-rpc/
14-
final class JsonRpcServerAttributesExtractor implements AttributesExtractor<JsonRpcRequest, JsonRpcResponse> {
19+
final class JsonRpcServerAttributesExtractor
20+
implements AttributesExtractor<JsonRpcRequest, JsonRpcResponse> {
1521

1622
private static final AttributeKey<Long> RPC_JSONRPC_ERROR_CODE =
1723
AttributeKey.longKey("rpc.jsonrpc.error_code");
1824

1925
private static final AttributeKey<String> RPC_JSONRPC_ERROR_MESSAGE =
2026
AttributeKey.stringKey("rpc.jsonrpc.error_message");
2127

22-
// private final JsonRpcServerAttributesGetter getter;
23-
//
24-
//
25-
// JsonRpcServerAttributesExtractor(JsonRpcServerAttributesGetter getter) {
26-
// this.getter = getter;
27-
// }
28+
// private final JsonRpcServerAttributesGetter getter;
29+
//
30+
//
31+
// JsonRpcServerAttributesExtractor(JsonRpcServerAttributesGetter getter) {
32+
// this.getter = getter;
33+
// }
2834

2935
@Override
30-
public void onStart(AttributesBuilder attributes, Context parentContext,
31-
JsonRpcRequest jsonRpcRequest) {
36+
public void onStart(
37+
AttributesBuilder attributes, Context parentContext, JsonRpcRequest jsonRpcRequest) {
3238
attributes.put("rpc.jsonrpc.version", "2.0");
3339
}
3440

@@ -41,8 +47,12 @@ public void onEnd(
4147
@Nullable Throwable error) {
4248
// use the DEFAULT_ERROR_RESOLVER to extract error code and message
4349
if (error != null) {
44-
ErrorResolver errorResolver = new MultipleErrorResolver(AnnotationsErrorResolver.INSTANCE, DefaultErrorResolver.INSTANCE);
45-
ErrorResolver.JsonError jsonError = errorResolver.resolveError(error, jsonRpcRequest.getMethod(), jsonRpcRequest.getArguments());
50+
ErrorResolver errorResolver =
51+
new MultipleErrorResolver(
52+
AnnotationsErrorResolver.INSTANCE, DefaultErrorResolver.INSTANCE);
53+
ErrorResolver.JsonError jsonError =
54+
errorResolver.resolveError(
55+
error, jsonRpcRequest.getMethod(), jsonRpcRequest.getArguments());
4656
attributes.put(RPC_JSONRPC_ERROR_CODE, jsonError.code);
4757
attributes.put(RPC_JSONRPC_ERROR_MESSAGE, jsonError.message);
4858
} else {

instrumentation/jsonrpc4j-1.6/library/src/main/java/io/opentelemetry/instrumentation/jsonrpc4j/v1_6/JsonRpcServerAttributesGetter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
16
package io.opentelemetry.instrumentation.jsonrpc4j.v1_6;
27

38
import com.googlecode.jsonrpc4j.JsonRpcService;
49
import io.opentelemetry.instrumentation.api.incubator.semconv.rpc.RpcAttributesGetter;
510

6-
// Check https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-metrics.md#attributes
11+
// Check
12+
// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/rpc/rpc-metrics.md#attributes
713
// Check https://opentelemetry.io/docs/specs/semconv/rpc/json-rpc/
814
public enum JsonRpcServerAttributesGetter implements RpcAttributesGetter<JsonRpcRequest> {
915
INSTANCE;

0 commit comments

Comments
 (0)