nulinuli-nuli opened a new issue, #15088:
URL: https://github.com/apache/dubbo/issues/15088

   ### Pre-check
   
   - [x] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   Dubbo: 2.7.7
   Java: 1.8
   
   i want use MonitorFilter,but i found not have output.
   
   output set in here
   private void logMessageLength(Object result, int bytes) {
       if (bytes > 0) {
           if (result instanceof Request) {
               try {
                   
((RpcInvocation)((Request)result).getData()).setAttachment("input", 
String.valueOf(bytes));
               } catch (Throwable var5) {
               }
           } else if (result instanceof Response) {
               try {
                   
((AppResponse)((Response)result).getResult()).setAttachment("output", 
String.valueOf(bytes));
               } catch (Throwable var4) {
               }
           }
   
       }
   }
   
   but when after this, output is lose
     private void decode(Object message) {
         if (message instanceof Decodeable) {
             try {
                 ((Decodeable)message).decode();
                 if (log.isDebugEnabled()) {
                     log.debug("Decode decodeable message " + 
message.getClass().getName());
                 }
             } catch (Throwable var3) {
                 Throwable e = var3;
                 if (log.isWarnEnabled()) {
                     log.warn("Call Decodeable.decode failed: " + 
e.getMessage(), e);
                 }
             }
         }
   
     }
   
   ### Steps to reproduce this issue
   
   use dubbo 2.7.7 then debug can reproduce ,very easy
   
   ### What you expected to happen
   
   i cat hava output in this code
       private URL createStatisticsUrl(Invoker<?> invoker, Invocation 
invocation, Result result, String remoteHost, long start, boolean error) {
           // ---- service statistics ----
           long elapsed = System.currentTimeMillis() - start; // invocation cost
           int concurrent = getConcurrent(invoker, invocation).get(); // 
current concurrent count
           String application = invoker.getUrl().getParameter(APPLICATION_KEY);
           String service = invoker.getInterface().getName(); // service name
           String method = RpcUtils.getMethodName(invocation); // method name
           String group = invoker.getUrl().getParameter(GROUP_KEY);
           String version = invoker.getUrl().getParameter(VERSION_KEY);
   
           int localPort;
           String remoteKey, remoteValue;
           if (CONSUMER_SIDE.equals(invoker.getUrl().getParameter(SIDE_KEY))) {
               // ---- for service consumer ----
               localPort = 0;
               remoteKey = MonitorService.PROVIDER;
               remoteValue = invoker.getUrl().getAddress();
           } else {
               // ---- for service provider ----
               localPort = invoker.getUrl().getPort();
               remoteKey = MonitorService.CONSUMER;
               remoteValue = remoteHost;
           }
           String input = "", output = "";
           if (invocation.getAttachment(INPUT_KEY) != null) {
               input = invocation.getAttachment(INPUT_KEY);
           }
           if (result != null && result.getAttachment(OUTPUT_KEY) != null) {
               output = result.getAttachment(OUTPUT_KEY);
           }
   
           return new URL(COUNT_PROTOCOL, NetUtils.getLocalHost(), localPort, 
service + PATH_SEPARATOR + method, MonitorService.APPLICATION, application, 
MonitorService.INTERFACE, service, MonitorService.METHOD, method, remoteKey, 
remoteValue, error ? MonitorService.FAILURE : MonitorService.SUCCESS, "1", 
MonitorService.ELAPSED, String.valueOf(elapsed), MonitorService.CONCURRENT, 
String.valueOf(concurrent), INPUT_KEY, input, OUTPUT_KEY, output, GROUP_KEY, 
group, VERSION_KEY, version);
       }
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [ ] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to