[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-09-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16172688#comment-16172688
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

Github user dongeforever commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/156#discussion_r139869366
  
--- Diff: 
client/src/main/java/org/apache/rocketmq/client/hook/TracerTimeSendMessageHook.java
 ---
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.client.hook;
+
+import java.lang.reflect.Method;
+import org.apache.rocketmq.common.ClientTracerTimeUtil;
+import org.apache.rocketmq.common.message.Message;
+import org.apache.rocketmq.common.message.MessageConst;
+
+public class TracerTimeSendMessageHook implements SendMessageHook {
+
+@Override
+public String hookName() {
+return "TracerTimeSendMessageHook";
+}
+
+@Override
+public void sendMessageBefore(SendMessageContext context) {
+tracerTimeIfNecessary(context.getMessage(), 
MessageConst.MESSAGE_SEND_TIME);
+}
+
+@Override
+public void sendMessageAfter(SendMessageContext context) {
+tracerTimeIfNecessary(context.getMessage(), 
MessageConst.RECEIVE_SEND_ACK_TIME);
+}
+
+public void tracerTimeIfNecessary(Message msg, String propertyKey) {
+if (ClientTracerTimeUtil.isEnableTracerTime()) {
+try {
+Method putPropertyMethod = 
msg.getClass().getDeclaredMethod("putProperty", String.class, String.class);
--- End diff --

Better to use MessageAccessor instead of reflection 


> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-09-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16172689#comment-16172689
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

Github user dongeforever commented on a diff in the pull request:

https://github.com/apache/incubator-rocketmq/pull/156#discussion_r139868962
  
--- Diff: 
broker/src/main/java/org/apache/rocketmq/broker/ServerTracerTimeUtil.java ---
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.rocketmq.broker;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import java.util.concurrent.TimeUnit;
+import org.apache.rocketmq.common.ClientTracerTimeUtil;
+import org.apache.rocketmq.common.TracerTime;
+
+public class ServerTracerTimeUtil {
+
+public static Cache tracerTimeCache = 
CacheBuilder.newBuilder()
+.maximumSize(1)
+.expireAfterWrite(15, TimeUnit.MINUTES)
+.build();
+
+public static boolean isEnableTracerTime() {
+return ClientTracerTimeUtil.isEnableTracerTime();
+}
+
+public static void addMessageCreateTime(String messageTracerTimeId, 
String messageCreateTime) {
+if (messageCreateTime == null || messageCreateTime.length() < 1) {
+return;
+}
+
+TracerTime tracerTime = 
tracerTimeCache.getIfPresent(messageTracerTimeId);
+if (tracerTime == null) {
+tracerTime = new TracerTime();
--- End diff --

getIfPresent  may have concurrent problem

Maybe getOrDefault is OK



> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-09-19 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16172677#comment-16172677
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

Github user dongeforever commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/156
  
LGTM @zhouxinyu @vongosling 


> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-09-07 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16157996#comment-16157996
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/156
  

[![Coverage 
Status](https://coveralls.io/builds/13178521/badge)](https://coveralls.io/builds/13178521)

Coverage decreased (-1.6%) to 37.094% when pulling 
**94ffbc33084381858b13592ea7b0a068479b77ce on fuyou001:ROCKETMQ-271** into 
**368e7c86a0b06099f336c81672112dcb5143cf9e on apache:develop**.



> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16156512#comment-16156512
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/156
  

[![Coverage 
Status](https://coveralls.io/builds/13161737/badge)](https://coveralls.io/builds/13161737)

Coverage decreased (-1.6%) to 37.136% when pulling 
**8a5b0340d8d2bd1ea4c5300e86028273d97535ef on fuyou001:ROCKETMQ-271** into 
**368e7c86a0b06099f336c81672112dcb5143cf9e on apache:develop**.



> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16156358#comment-16156358
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/156
  

[![Coverage 
Status](https://coveralls.io/builds/13160642/badge)](https://coveralls.io/builds/13160642)

Coverage decreased (-1.6%) to 37.152% when pulling 
**934d203bd724a4f7a2cc64af6c300ba8a35887b6 on fuyou001:ROCKETMQ-271** into 
**368e7c86a0b06099f336c81672112dcb5143cf9e on apache:develop**.



> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-09-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16156354#comment-16156354
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

Github user coveralls commented on the issue:

https://github.com/apache/incubator-rocketmq/pull/156
  

[![Coverage 
Status](https://coveralls.io/builds/13160524/badge)](https://coveralls.io/builds/13160524)

Coverage decreased (-1.6%) to 37.152% when pulling 
**9f6ead962c510c69b5a29480e040a84d751aebf8 on fuyou001:ROCKETMQ-271** into 
**368e7c86a0b06099f336c81672112dcb5143cf9e on apache:develop**.



> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ROCKETMQ-271) add diagnosis tools

2017-08-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ROCKETMQ-271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16143311#comment-16143311
 ] 

ASF GitHub Bot commented on ROCKETMQ-271:
-

GitHub user fuyou001 opened a pull request:

https://github.com/apache/incubator-rocketmq/pull/156

[ROCKETMQ-271] add tools for Analyzing message lifetime

Motivation:
 add a tools for analyzing message lifetime

Modification:
   server: add LRU cache for save message lifetime info ,add new rpc 
service query message lifetime info,add a new tool query message lifetime info.
  client: add some message lifetime info when create message and send 
message



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/fuyou001/incubator-rocketmq ROCKETMQ-271

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-rocketmq/pull/156.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #156


commit 306968f2b4fdd04059fc001991979844ccf10727
Author: 傅冲 
Date:   2017-08-24T12:46:07Z

[ROCKETMQ-271] add tools for Analyzing message lifetime




> add diagnosis tools
> ---
>
> Key: ROCKETMQ-271
> URL: https://issues.apache.org/jira/browse/ROCKETMQ-271
> Project: Apache RocketMQ
>  Issue Type: New Feature
>  Components: rocketmq-broker, rocketmq-client, rocketmq-commons, 
> rocketmq-remoting
>Reporter: yubaofu
>Assignee: yukon
>Priority: Minor
>   Original Estimate: 96h
>  Remaining Estimate: 96h
>
> when prodcurer send message timeout,how to find the root cause,it's difficult.
> so add the new diagnosis tools that record message lifetime ,eg message 
> create time,prodcurer send message to broker time,broker recive message 
> time,and send response to client time.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)