Skip to content

Commit b859165

Browse files
committed
fix style
1 parent 7781c8c commit b859165

File tree

7 files changed

+53
-37
lines changed

7 files changed

+53
-37
lines changed

instrumentation/jsonrpc4j-1.6/javaagent/build.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ dependencies {
1919
testImplementation(project(":instrumentation:jsonrpc4j-1.6:testing"))
2020
}
2121

22-
2322
tasks {
2423
test {
2524
systemProperty("testLatestDeps", findProperty("testLatestDeps") as Boolean)

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

+17-9
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.javaagent.instrumentation.jsonrpc4j.v1_6;
27

38
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
@@ -15,10 +20,10 @@
1520
import io.opentelemetry.instrumentation.jsonrpc4j.v1_6.SimpleJsonRpcResponse;
1621
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
1722
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
23+
import java.util.Map;
1824
import net.bytebuddy.asm.Advice;
1925
import net.bytebuddy.description.type.TypeDescription;
2026
import net.bytebuddy.matcher.ElementMatcher;
21-
import java.util.Map;
2227

2328
public class JsonRpcClientBuilderInstrumentation implements TypeInstrumentation {
2429

@@ -37,8 +42,8 @@ public ElementMatcher<TypeDescription> typeMatcher() {
3742
public void transform(TypeTransformer transformer) {
3843
transformer.applyAdviceToMethod(
3944
isMethod()
40-
.and(named("invoke"))
41-
.and(takesArguments(4))
45+
.and(named("invoke"))
46+
.and(takesArguments(4))
4247
.and(takesArgument(0, String.class))
4348
.and(takesArgument(1, Object.class))
4449
.and(takesArgument(2, named("java.lang.reflect.Type")))
@@ -58,16 +63,15 @@ public static void onEnter(
5863
@Advice.Local("otelContext") Context context,
5964
@Advice.Local("otelScope") Scope scope) {
6065
Context parentContext = Context.current();
61-
SimpleJsonRpcRequest request = new SimpleJsonRpcRequest(
62-
methodName,
63-
argument
64-
);
66+
SimpleJsonRpcRequest request = new SimpleJsonRpcRequest(methodName, argument);
6567
if (!JsonRpcSingletons.CLIENT_INSTRUMENTER.shouldStart(parentContext, request)) {
6668
return;
6769
}
6870

6971
context = JsonRpcSingletons.CLIENT_INSTRUMENTER.start(parentContext, request);
70-
JsonRpcSingletons.PROPAGATORS.getTextMapPropagator().inject(context, extraHeaders, HeadersSetter.INSTANCE);
72+
JsonRpcSingletons.PROPAGATORS
73+
.getTextMapPropagator()
74+
.inject(context, extraHeaders, HeadersSetter.INSTANCE);
7175

7276
scope = context.makeCurrent();
7377
}
@@ -86,7 +90,11 @@ public static void onExit(
8690
}
8791

8892
scope.close();
89-
JsonRpcSingletons.CLIENT_INSTRUMENTER.end(context, new SimpleJsonRpcRequest(methodName, argument), new SimpleJsonRpcResponse(result), throwable);
93+
JsonRpcSingletons.CLIENT_INSTRUMENTER.end(
94+
context,
95+
new SimpleJsonRpcRequest(methodName, argument),
96+
new SimpleJsonRpcResponse(result),
97+
throwable);
9098
System.out.println(extraHeaders);
9199
}
92100
}

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

+6-2
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.javaagent.instrumentation.jsonrpc4j.v1_6;
27

38
import static java.util.Arrays.asList;
@@ -18,7 +23,6 @@ public List<TypeInstrumentation> typeInstrumentations() {
1823
return asList(
1924
new JsonRpcServerBuilderInstrumentation(),
2025
new JsonServiceExporterBuilderInstrumentation(),
21-
new JsonRpcClientBuilderInstrumentation()
22-
);
26+
new JsonRpcClientBuilderInstrumentation());
2327
}
2428
}

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

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

38
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
49
import static net.bytebuddy.matcher.ElementMatchers.isConstructor;
510
import static net.bytebuddy.matcher.ElementMatchers.named;
611

712
import com.googlecode.jsonrpc4j.InvocationListener;
13+
import com.googlecode.jsonrpc4j.JsonRpcBasicServer;
14+
import io.opentelemetry.instrumentation.api.util.VirtualField;
815
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
916
import io.opentelemetry.javaagent.extension.instrumentation.TypeTransformer;
17+
import net.bytebuddy.asm.Advice;
1018
import net.bytebuddy.description.type.TypeDescription;
11-
import io.opentelemetry.instrumentation.api.util.VirtualField;
1219
import net.bytebuddy.matcher.ElementMatcher;
13-
import com.googlecode.jsonrpc4j.JsonRpcBasicServer;
14-
import net.bytebuddy.asm.Advice;
1520

1621
public class JsonRpcServerBuilderInstrumentation implements TypeInstrumentation {
1722

18-
1923
@Override
2024
public ElementMatcher<ClassLoader> classLoaderOptimization() {
2125
return hasClassesNamed("com.googlecode.jsonrpc4j.JsonRpcBasicServer");
@@ -29,8 +33,7 @@ public ElementMatcher<TypeDescription> typeMatcher() {
2933
@Override
3034
public void transform(TypeTransformer transformer) {
3135
transformer.applyAdviceToMethod(
32-
isConstructor(),
33-
this.getClass().getName() + "$ConstructorAdvice");
36+
isConstructor(), this.getClass().getName() + "$ConstructorAdvice");
3437
}
3538

3639
@SuppressWarnings("unused")
@@ -48,5 +51,4 @@ public static void setInvocationListener(
4851
}
4952
}
5053
}
51-
5254
}
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.javaagent.instrumentation.jsonrpc4j.v1_6;
27

38
import com.googlecode.jsonrpc4j.InvocationListener;
@@ -8,7 +13,6 @@
813
import io.opentelemetry.instrumentation.jsonrpc4j.v1_6.SimpleJsonRpcRequest;
914
import io.opentelemetry.instrumentation.jsonrpc4j.v1_6.SimpleJsonRpcResponse;
1015

11-
1216
public final class JsonRpcSingletons {
1317

1418
public static final InvocationListener SERVER_INVOCATION_LISTENER;
@@ -18,15 +22,12 @@ public final class JsonRpcSingletons {
1822
public static final ContextPropagators PROPAGATORS;
1923

2024
static {
21-
JsonRpcTelemetry telemetry =
22-
JsonRpcTelemetry.builder(GlobalOpenTelemetry.get())
23-
.build();
25+
JsonRpcTelemetry telemetry = JsonRpcTelemetry.builder(GlobalOpenTelemetry.get()).build();
2426

2527
SERVER_INVOCATION_LISTENER = telemetry.newServerInvocationListener();
2628
CLIENT_INSTRUMENTER = telemetry.getClientInstrumenter();
2729
PROPAGATORS = telemetry.getPropagators();
2830
}
2931

30-
3132
private JsonRpcSingletons() {}
3233
}

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

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

8+
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
9+
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
10+
import static net.bytebuddy.matcher.ElementMatchers.named;
11+
312
import com.googlecode.jsonrpc4j.JsonRpcServer;
413
import com.googlecode.jsonrpc4j.spring.JsonServiceExporter;
514
import io.opentelemetry.instrumentation.api.util.VirtualField;
@@ -9,11 +18,6 @@
918
import net.bytebuddy.description.type.TypeDescription;
1019
import net.bytebuddy.matcher.ElementMatcher;
1120

12-
13-
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed;
14-
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
15-
import static net.bytebuddy.matcher.ElementMatchers.named;
16-
1721
public class JsonServiceExporterBuilderInstrumentation implements TypeInstrumentation {
1822
@Override
1923
public ElementMatcher<ClassLoader> classLoaderOptimization() {
@@ -28,8 +32,7 @@ public ElementMatcher<TypeDescription> typeMatcher() {
2832
@Override
2933
public void transform(TypeTransformer transformer) {
3034
transformer.applyAdviceToMethod(
31-
isMethod().and(named("exportService")),
32-
this.getClass().getName() + "$ExportAdvice");
35+
isMethod().and(named("exportService")), this.getClass().getName() + "$ExportAdvice");
3336
}
3437

3538
@SuppressWarnings("unused")
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.javaagent.instrumentation.jsonrpc4j.v1_6;
27

38
import com.googlecode.jsonrpc4j.JsonRpcBasicServer;
@@ -8,11 +13,9 @@
813

914
public class AgentJsonRpcTest extends AbstractJsonRpcTest {
1015

11-
1216
@RegisterExtension
1317
static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
1418

15-
1619
@Override
1720
protected InstrumentationExtension testing() {
1821
return testing;
@@ -22,8 +25,4 @@ protected InstrumentationExtension testing() {
2225
protected JsonRpcBasicServer configureServer(JsonRpcBasicServer server) {
2326
return server;
2427
}
25-
26-
27-
28-
2928
}

0 commit comments

Comments
 (0)