Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ dependencies {
library("org.apache.wicket:wicket:8.0.0")

testImplementation(project(":instrumentation:wicket-8.0:common-testing"))
testImplementation("org.jsoup:jsoup:1.13.1")
testImplementation("org.eclipse.jetty:jetty-server:8.0.0.v20110901")
testImplementation("org.eclipse.jetty:jetty-servlet:8.0.0.v20110901")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class XxlJobSingletons {
XxlJobHelper.create(
instrumenter,
object -> {
if (object != null && (object instanceof ReturnT)) {
if (object instanceof ReturnT) {
ReturnT<?> result = (ReturnT<?>) object;
return result.getCode() == ReturnT.FAIL_CODE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,21 @@ class XxlJobTest extends AbstractXxlJobTest {
METHOD_JOB_HANDLER_INIT_METHOD,
METHOD_JOB_HANDLER_DESTROY_METHOD);

private static final IJobHandler groovyHandler;
private static final IJobHandler groovyHandler = createGroovyHandler();
private static final GlueJobHandler glueJobHandler =
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);
private static final ScriptJobHandler scriptJobHandler =
new ScriptJobHandler(
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);

static {
private static IJobHandler createGroovyHandler() {
try {
groovyHandler = GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
return GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

private static final GlueJobHandler glueJobHandler =
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);

private static final ScriptJobHandler scriptJobHandler =
new ScriptJobHandler(
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);

@Override
protected String getPackageName() {
return "io.opentelemetry.javaagent.instrumentation.xxljob.v2_3_0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,6 @@

class ReflectiveMethodsFactory {

private ReflectiveMethodsFactory() {}

public static class ReflectObject {

private ReflectObject() {}

public void initMethod() {}

public void destroyMethod() {}

public Response<String> echo(String param) {
Response<String> result = new Response<>();
result.setData("echo: " + param);
return result;
}
}

private static final Object singletonObject = new ReflectObject();

static Object getTarget() {
Expand All @@ -52,4 +35,21 @@ private static Method getRequiredMethod(String name, Class<?>... parameterTypes)
throw new IllegalStateException("Failed to resolve reflective method: " + name, e);
}
}

private ReflectiveMethodsFactory() {}

public static class ReflectObject {

private ReflectObject() {}

public void initMethod() {}

public void destroyMethod() {}

public Response<String> echo(String param) {
Response<String> result = new Response<>();
result.setData("echo: " + param);
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,21 @@ class XxlJobTest extends AbstractXxlJobTest {
ReflectiveMethodsFactory.getInitMethod(),
ReflectiveMethodsFactory.getDestroyMethod());

private static final IJobHandler groovyHandler;
private static final IJobHandler groovyHandler = createGroovyHandler();
private static final GlueJobHandler glueJobHandler =
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);
private static final ScriptJobHandler scriptJobHandler =
new ScriptJobHandler(
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);

static {
private static IJobHandler createGroovyHandler() {
try {
groovyHandler = GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
return GlueFactory.getInstance().loadNewInstance(GLUE_JOB_GROOVY_SOURCE);
} catch (Exception e) {
throw new IllegalStateException(e);
}
}

private static final GlueJobHandler glueJobHandler =
new GlueJobHandler(groovyHandler, DEFAULT_GLUE_UPDATE_TIME);

private static final ScriptJobHandler scriptJobHandler =
new ScriptJobHandler(
2, DEFAULT_GLUE_UPDATE_TIME, GLUE_JOB_SHELL_SCRIPT, GlueTypeEnum.GLUE_SHELL);

@Override
protected String getPackageName() {
return "io.opentelemetry.javaagent.instrumentation.xxljob.v3_3_0";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import javax.annotation.Nullable;

class ExperimentalTestHelper {
private static final boolean isEnabled =
private static final boolean EXPERIMENTAL_ATTRIBUTES =
Boolean.getBoolean("otel.instrumentation.xxl-job.experimental-span-attributes");

@Nullable
static <T> T experimental(T value) {
if (isEnabled) {
if (EXPERIMENTAL_ATTRIBUTES) {
return value;
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,6 @@

class ReflectiveMethodsFactory {

private ReflectiveMethodsFactory() {}

public static class ReflectObject {

private ReflectObject() {}

public void initMethod() {}

public void destroyMethod() {}

public ReturnT<String> echo(String param) {
ReturnT<String> result = new ReturnT<>();
result.setContent("echo: " + param);
return result;
}
}

private static final Object singletonObject = new ReflectObject();

static Object getTarget() {
Expand Down Expand Up @@ -60,4 +43,21 @@ static Method getDestroyMethod() {
return null;
}
}

private ReflectiveMethodsFactory() {}

public static class ReflectObject {

private ReflectObject() {}

public void initMethod() {}

public void destroyMethod() {}

public ReturnT<String> echo(String param) {
ReturnT<String> result = new ReturnT<>();
result.setContent("echo: " + param);
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

public class XxlJobTestingConstants {

private XxlJobTestingConstants() {}

public static final String GLUE_JOB_SHELL_SCRIPT = "echo 'hello'";

public static final long DEFAULT_GLUE_UPDATE_TIME = System.currentTimeMillis();
Expand Down Expand Up @@ -47,4 +45,6 @@ private XxlJobTestingConstants() {}
+ " void execute() throws Exception {\n"
+ " }\n"
+ "}\n";

private XxlJobTestingConstants() {}
}
2 changes: 1 addition & 1 deletion instrumentation/zio/zio-2.0/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ dependencies {
}

tasks {
withType<Test>().configureEach {
test {
jvmArgs("-Dio.opentelemetry.javaagent.shaded.io.opentelemetry.context.enableStrictContext=false")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void transform(TypeTransformer transformer) {
}

@SuppressWarnings("unused")
public static final class CreateRouteAdvice {
public static class CreateRouteAdvice {

@Advice.OnMethodEnter(suppress = Throwable.class, inline = false)
@Advice.AssignReturned.ToArguments(@ToArgument(0))
Expand Down
Loading