org.apache.dubbo.rpc.Filter Java Examples

The following examples show how to use org.apache.dubbo.rpc.Filter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ITTracingFilter_Consumer.java    From brave with Apache License 2.0 6 votes vote down vote up
/** Shows if you aren't using RpcTracing, the old "dubbo.error_code" works */
@Test public void setError_onUnimplemented_legacy() {
  ((TracingFilter) ExtensionLoader.getExtensionLoader(Filter.class)
      .getExtension("tracing")).isInit = false;

  ((TracingFilter) ExtensionLoader.getExtensionLoader(Filter.class)
      .getExtension("tracing"))
      .setTracing(tracing);

  assertThatThrownBy(() -> wrongClient.get().sayHello("jorge"))
      .isInstanceOf(RpcException.class);

  MutableSpan span =
      testSpanHandler.takeRemoteSpanWithErrorMessage(CLIENT, ".*Not found exported service.*");
  assertThat(span.tags())
      .containsEntry("dubbo.error_code", "1");
}
 
Example #2
Source File: ITTracingFilter.java    From brave with Apache License 2.0 5 votes vote down vote up
/** Call this after updating {@link #tracing} */
TracingFilter init() {
  TracingFilter filter = (TracingFilter) ExtensionLoader.getExtensionLoader(Filter.class)
    .getExtension("tracing");
  filter.setTracing(tracing);
  return filter;
}