You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/03/11 15:47:27 UTC

[GitHub] [hadoop-ozone] elek commented on issue #645: HDDS-3130. Add jaeger trace span in s3gateway

elek commented on issue #645: HDDS-3130. Add jaeger trace span in s3gateway
URL: https://github.com/apache/hadoop-ozone/pull/645#issuecomment-597710811
 
 
   Thank you very much the idea and the patch @runzhiwang I 100% support to introduce tracing for s3g. It's a very good idea.
   
   About the implementation: It's definitely a step forward but I started to think how is it possible to do in a transparent way without duplication. I check if the resource name is available from some generic filter and it seems to be possible.
   
   My proposal is to do it from a central place, something like this:
   
   ```
   @Provider
   public class TracingFilter implements ContainerRequestFilter,
       ContainerResponseFilter {
   
     public static final String TRACING_SCOPE = "TRACING_SCOPE";
   
     @Context
     private ResourceInfo resourceInfo;
   
     @Override
     public void filter(ContainerRequestContext requestContext)
         throws IOException {
       Scope scope = GlobalTracer.get().buildSpan(
           resourceInfo.getResourceClass().getSimpleName() + "." + resourceInfo
               .getResourceMethod().getName()).startActive(true);
   
       requestContext.setProperty(TRACING_SCOPE, scope);
     }
   
     @Override
     public void filter(ContainerRequestContext requestContext,
         ContainerResponseContext responseContext) throws IOException {
   
       Object scope = requestContext.getProperty(TRACING_SCOPE);
       if (scope != null) {
         ((Scope) scope).span().finish();
       }
     }
   }
   ``` 
   
   What do you think? I think it would simplify this patch (you don't need to modify all the methods...)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org