@Override
    public void filter(ContainerRequestContext requestContext) throws IOException {

        try {
            SofaResourceMethodInvoker resourceMethodInvoker = (SofaResourceMethodInvoker)
                    ((PostMatchContainerRequestContext) requestContext)
                        .getResourceMethod();

            SofaResourceFactory factory = resourceMethodInvoker.getResource();
            String serviceName = factory.getServiceName();
            String appName = factory.getAppName();

            if (serviceName == null) {
                serviceName = resourceMethodInvoker.getResourceClass().getName();
            }

            String methodName = resourceMethodInvoker.getMethod().getName();

            RpcInternalContext context = RpcInternalContext.getContext();
            context.setAttachment(INTERNAL_KEY_PREFIX + RestConstants.REST_SERVICE_KEY, serviceName + ":1.0");
            context.setAttachment(INTERNAL_KEY_PREFIX + RestConstants.REST_METHODNAME_KEY, methodName);

            context.setAttachment(INTERNAL_KEY_PREFIX + RemotingConstants.HEAD_APP_NAME, appName);
        } catch (Exception e) {
            logger.error(LogCodes.getLog(LogCodes.ERROR_LOOKOUT_PROCESS), e);
        }

    }
@author <a href="mailto:zhiyuan.lzy@antfin.com">liangen</a>
tracer/tracer-opentracing-resteasy/src/main/java/com/alipay/sofa/rpc/server/rest/LookoutRequestFilter.java