opentracing-contrib / java-jaxrs

OpenTracing Java JAX-RS instrumentation
Apache License 2.0
37 stars 33 forks source link

WildcardOperationName can't get value of @Path when using interface #120

Closed haosong closed 5 years ago

haosong commented 5 years ago

Currently, WildcardOperationName won't be able to get value of @Path annotation if using API interface as follows:

// Interface, TestService.java
@Path("/foo")
public interface TestService {
  @GET
  @Path("/bar")
  Response test();
}

// Implementation, TestServiceImpl.java
public class TestServiceImpl implements TestService {
  public Response test() {
    return Response.ok().build();
  }
}

Probably can add some logic after here to get the value from interface class as follows:

if (classPath.isEmpth() || methodPath.isEmpty()) {
  for (Class<?> c : clazz.getInterfaces()) {
    // Get @Path value from interface class
  }
}
objectiser commented 5 years ago

@song-hao Would you be interested in submitting a PR to fix this?

haosong commented 5 years ago

@song-hao Would you be interested in submitting a PR to fix this?

Sure, will submit one.